-
Notifications
You must be signed in to change notification settings - Fork 2
148 lines (148 loc) · 4.43 KB
/
release.yml
File metadata and controls
148 lines (148 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
name: Stucco release
env:
CGO_ENABLED: 0
jobs:
build_cli:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
go-version: [1.18.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
goarch: [amd64, 386, arm64]
include:
- platform: ubuntu-latest
goos: linux
- platform: macos-latest
goos: darwin
- platform: windows-latest
goos: windows
ext: '.exe'
exclude:
- platform: macos-latest
goarch: 386
runs-on: ${{ matrix.platform }}
steps:
- name: setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: checkout
uses: actions/checkout@v1
- name: cache deps
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: version
id: version
uses: frabert/replace-string-action@v1.1
with:
pattern: 'refs/tags/(.*)'
string: '${{ github.ref }}'
replace-with: '$1'
- name: build tasks
run: go build -o tasks ./hack/tasks.go
- name: build cli
run: ./tasks -version ${{ steps.version.outputs.replaced }} bin/cli/${{ matrix.goos }}/${{ matrix.goarch }}/stucco${{ matrix.ext }}
- name: test
env:
CGO_ENABLED: 1
run: |
./tasks test
./tasks test-race
- uses: actions/upload-artifact@v2
with:
name: binaries
path: bin
build_azure_function:
needs:
- build_cli
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
go-version: [1.18.x]
platform: [ubuntu-latest]
include:
- platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
steps:
- name: setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: checkout
uses: actions/checkout@v1
- name: cache deps
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: version
id: version
uses: frabert/replace-string-action@v1.1
with:
pattern: 'refs/tags/(.*)'
string: '${{ github.ref }}'
replace-with: '$1'
- name: build tasks
run: go build -o tasks ./hack/tasks.go
- name: build azure function
run: ./tasks -version ${{ steps.version.outputs.replaced }} build_azure_function
- uses: actions/upload-artifact@v2
with:
name: binaries
path: bin
release:
needs:
- build_cli
- build_azure_function
runs-on: ubuntu-latest
steps:
- name: pull artifacts
uses: actions/download-artifact@v2
with:
name: binaries
path: bin
- name: version
id: version
uses: frabert/replace-string-action@v1.1
with:
pattern: 'refs/tags/(.*)'
string: '${{ github.ref }}'
replace-with: '$1'
- name: copy latest version
run: |
mv bin/cli bin/${{ steps.version.outputs.replaced }}
mv bin/azure bin/${{ steps.version.outputs.replaced }}
cp -r bin/${{ steps.version.outputs.replaced }} bin/latest
echo "${{ steps.version.outputs.replaced }}" > bin/latest/version
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: 'stucco-release'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_ENDPOINT: 'https://fra1.digitaloceanspaces.com'
AWS_REGION: 'fra1'
SOURCE_DIR: 'bin'
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: true
body: |
Download links and changes from previous version available in [CHANGELOG.md](https://github.com/graphql-editor/stucco/blob/${{ steps.version.outputs.replaced }}/CHANGELOG.md)