-
Notifications
You must be signed in to change notification settings - Fork 6
148 lines (143 loc) · 4 KB
/
release.yml
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
name: Release
run-name: Release ${{ github.ref_name }}
on:
push:
branches:
- next
- prerelease
workflow_dispatch:
inputs:
branch:
required: true
type: choice
default: main
options:
- main
- next
- prerelease
jobs:
distribution:
runs-on: ubuntu-latest
steps:
- name: Assign branch
shell: bash
run: |
if ${{ github.event_name == 'workflow_dispatch' }}
then
echo "Set branch to ${{ inputs.branch }} for manual trigger"
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_ENV
else if ${{ github.event_name == 'push' }}
echo "Set branch to ${{ github.ref_name }} for push trigger"
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
fi
semantic-release:
needs: distribution
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.semantic.outputs.outputs.new_release_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 21.1.1
extra_plugins: |
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.KEEL_CI_SEMANTIC_RELEASE }}
- name: Version tag created
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
go-releaser:
needs:
- semantic-release
- distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
ref: ${{ needs.semantic-release.outputs.new_version }}
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.KEEL_CI_SEMANTIC_RELEASE }}
npm-publish:
needs:
- semantic-release
- distribution
runs-on: ubuntu-latest
strategy:
matrix:
package:
[
"wasm",
"functions-runtime",
"testing-runtime",
"client-react",
"client-react-query",
"keel"
]
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20
- uses: actions/setup-node@v3
with:
node-version: 18.12.1
token: ${{ secrets.NPM_TOKEN }}
- uses: pnpm/[email protected]
with:
version: 8.10.0
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ needs.semantic-release.outputs.new_version }}
fetch-depth: 0
- name: Install Go deps
if: ${{ matrix.package == 'wasm' }}
run: go mod download
- name: Generate wasm binary
if: ${{ matrix.package == 'wasm' }}
run: make wasm
- name: Install ${{ matrix.package }} publish dependencies
working-directory: ./packages/${{ matrix.package }}
run: pnpm install --frozen-lockfile
- uses: mad9000/actions-find-and-replace-string@2
id: make_package_version
with:
source: ${{ needs.semantic-release.outputs.new_version }}
find: 'v'
replace: ''
- name: "Update NPM version ${{ matrix.package }}"
uses: reedyuk/[email protected]
with:
version: ${{ steps.make_package_version.outputs.value }}
package: ./packages/${{ matrix.package }}
- name: NPM Publish ${{ matrix.package }}
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ env.BRANCH == 'main' && 'latest' || env.BRANCH }}
package: ./packages/${{ matrix.package }}
dry-run: false
strategy: all
ignore-scripts: false
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}