-
-
Notifications
You must be signed in to change notification settings - Fork 115
177 lines (161 loc) · 6.07 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Release
on:
push:
branches: [main]
# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
release-please:
name: Create Release
runs-on: ubuntu-latest
outputs:
release-pr: ${{ steps.release.outputs.pr }}
releases-created: ${{ steps.release.outputs.releases_created }}
tag-name: ${{ steps.release.outputs.tag_name }}
stdlib-tag-name: ${{ steps.release.outputs.stdlib--tag_name }}
steps:
- uses: GoogleCloudPlatform/[email protected]
id: release
with:
# Explicitly use GITHUB_TOKEN here so Release Please doesn't start a CI run that will fail
# The correct CI run is triggered by the `generate-docs` job below when it pushes updated documentation
token: ${{ secrets.GITHUB_TOKEN }}
command: manifest
build-preview:
name: Build preview binaries
needs: [release-please]
if: ${{ needs.release-please.outputs.release-pr }}
uses: ./.github/workflows/build-js.yml
with:
os: ubuntu-latest
ref: ${{ fromJSON(needs.release-please.outputs.release-pr).headBranchName }}
generate-docs:
name: Generate documentation
needs: [release-please, build-preview]
if: ${{ needs.release-please.outputs.release-pr }}
uses: ./.github/workflows/generate-docs.yml
with:
ref: ${{ fromJSON(needs.release-please.outputs.release-pr).headBranchName }}
secrets:
# This uses WORKFLOW_TOKEN because we want the push to trigger our `ci.yml` runs on the release PR
# and the GITHUB_TOKEN is blocked from triggering other workflows.
# See https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
PUSH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
upload-preview:
name: Upload preview binaries
needs: [release-please, build-preview]
if: ${{ needs.release-please.outputs.release-pr }}
uses: ./.github/workflows/upload-binaries.yml
with:
tag: preview
ref: ${{ fromJSON(needs.release-please.outputs.release-pr).headBranchName }}
secrets:
UPLOAD_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-release:
name: Build release binaries
needs: [release-please]
if: ${{ needs.release-please.outputs.releases-created }}
uses: ./.github/workflows/build-js.yml
with:
os: ubuntu-latest
ref: ${{ needs.release-please.outputs.tag-name }}
upload-release:
name: Upload release binaries
needs: [release-please, build-release]
if: ${{ needs.release-please.outputs.releases-created }}
uses: ./.github/workflows/upload-binaries.yml
with:
tag: ${{ needs.release-please.outputs.tag-name }}
ref: ${{ needs.release-please.outputs.tag-name }}
secrets:
UPLOAD_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload-npm-artifacts:
needs: [release-please]
if: ${{ needs.release-please.outputs.releases-created }}
name: Upload release npm artifacts
runs-on: ubuntu-latest
outputs:
stdlib-download-url: ${{ steps.stdlib-upload.outputs.browser_download_url }}
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
ref: ${{ needs.release-please.outputs.tag-name }}
# Many of these steps are the same as building the compiler for tests
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: ">=18.15 <19"
check-latest: true
cache: "npm"
- name: Pack stdlib
working-directory: ./stdlib
# Runs `npm pack` and assigns the filename to an env var we can use later
run: |
echo "STDLIB_TAR=$(npm pack --json | jq -r '.[0].filename')" >> $GITHUB_ENV
- name: Upload stdlib
id: stdlib-upload
uses: grain-lang/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
file: ./stdlib/${{ env.STDLIB_TAR }}
asset_name: stdlib.tgz
tag: ${{ needs.release-please.outputs.stdlib-tag-name }}
dispatch-website:
needs: [release-please, upload-release]
if: ${{ needs.release-please.outputs.releases-created }}
name: Dispatch website release
runs-on: ubuntu-latest
steps:
- uses: grain-lang/[email protected]
with:
workflow: Grain Release
token: ${{ secrets.WORKFLOW_TOKEN }}
ref: main
repo: grain-lang/grain-lang.org
tag_input: ${{ needs.release-please.outputs.tag-name }}
dispatch-homebrew:
needs: [release-please, upload-release]
if: ${{ needs.release-please.outputs.releases-created }}
name: Dispatch homebrew release
runs-on: ubuntu-latest
steps:
- uses: grain-lang/[email protected]
with:
workflow: Grain Release
token: ${{ secrets.WORKFLOW_TOKEN }}
ref: main
repo: grain-lang/homebrew-tap
tag_input: ${{ needs.release-please.outputs.tag-name }}
dispatch-docker:
needs: [release-please]
if: ${{ needs.release-please.outputs.releases-created }}
name: Dispatch Docker builds
runs-on: ubuntu-latest
steps:
- uses: grain-lang/[email protected]
with:
workflow: Publish Docker images
token: ${{ secrets.WORKFLOW_TOKEN }}
ref: main
repo: grain-lang/grain
tag_input: ${{ needs.release-please.outputs.tag-name }}
npm-release-stdlib:
needs: [release-please, upload-npm-artifacts]
if: ${{ needs.release-please.outputs.releases-created }}
name: Publish stdlib to npm registry
runs-on: ubuntu-latest
steps:
- name: Setup NodeJS
uses: actions/[email protected]
with:
node-version: ">=18.15 <19"
check-latest: true
registry-url: "https://registry.npmjs.org"
- name: Publish to npm
run: |
npm publish ${{ needs.upload-npm-artifacts.outputs.stdlib-download-url }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE }}