-
Notifications
You must be signed in to change notification settings - Fork 15
213 lines (193 loc) · 8.32 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: "Build Ark Release"
on:
push:
branches:
- feature/release-cleanup
workflow_dispatch:
jobs:
# Extract the current version of ARK from its Cargo.toml file.
get_version:
name: Determine ARK Version
runs-on: ubuntu-latest
outputs:
ARK_VERSION: ${{ steps.extract_version.outputs.result }}
steps:
# Checkout sources
- name: Checkout sources
uses: actions/checkout@v4
# Extract version
- name: Determine Version
id: extract_version
run: |
VERSION=$(cat crates/ark/Cargo.toml | grep '^version' | sed -e "s/[^.0-9]//g")
echo "ARK version: ${VERSION}"
echo "result=${VERSION}" >> $GITHUB_OUTPUT
# Check to see whether we have already released this version. If we have, we will skip the
# release process later on.
check_release:
name: Check for Existing Release
runs-on: ubuntu-latest
needs: [get_version]
outputs:
EXISTING_RELEASE: ${{ steps.release_flag.outputs.result }}
steps:
- name: Check for existing release tag
uses: mukunku/[email protected]
id: check_tag
with:
tag: ${{ needs.get_version.outputs.ARK_VERSION }}
- name: Set release flag
id: release_flag
run: |
echo "Existing ${{ needs.get_version.outputs.ARK_VERSION }} release: ${{steps.check_tag.outputs.exists}}"
echo "result=${{steps.check_tag.outputs.exists}}" >> $GITHUB_OUTPUT
do_release:
name: Trigger a new release
if: ${{ needs.check_release.outputs.EXISTING_RELEASE == 'false' }}
runs-on: ubuntu-latest
needs: [check_release]
steps:
- name: Dummy step
run: echo ""
# Build ARK for macOS. Both arm64 (Apple Silicon) and x64 (Intel) hosts.
build_macos:
name: Build macOS
runs-on: ubuntu-latest
# uses: ./.github/workflows/release-macos.yml
steps:
- name: Dummy step
run: echo ""
needs: [do_release, get_version]
# secrets: inherit
# with:
# version: ${{ needs.get_version.outputs.ARK_VERSION }}
build_windows:
name: Build Windows
runs-on: ubuntu-latest
# uses: ./.github/workflows/release-windows.yml
steps:
- name: Dummy step
run: echo ""
needs: [do_release, get_version]
# secrets: inherit
# with:
# version: ${{ needs.get_version.outputs.ARK_VERSION }}
build_linux:
name: "Build Linux"
runs-on: ubuntu-latest
# uses: ./.github/workflows/release-linux.yml
steps:
- name: Dummy step
run: echo ""
needs: [do_release, get_version]
# secrets: inherit
# with:
# version: ${{ needs.get_version.outputs.ARK_VERSION }}
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: [do_release, get_version, build_macos, build_windows, build_linux]
env:
GITHUB_TOKEN: ${{ github.token }}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: ${{ needs.get_version.outputs.ARK_VERSION }}
tag_name: ${{ needs.get_version.outputs.ARK_VERSION }}
# Uploads binaries, if we created a release
upload_release_binaries:
name: Upload Release Binaries
runs-on: macos-latest
needs: [create_release, get_version]
env:
GITHUB_TOKEN: ${{ github.token }}
DEBUG_FLAG: ${{ matrix.flavor == 'debug' && '-debug' || '' }}
strategy:
max-parallel: 1
matrix:
flavor: [debug, release]
steps:
# Download all binaries
- name: Download macOS universal kernel (${{ matrix.flavor}})
uses: actions/download-artifact@v4
with:
name: ark-${{ matrix.flavor }}-darwin-universal-archive
- name: Download Windows x64 kernel (${{ matrix.flavor}})
uses: actions/download-artifact@v4
with:
name: ark-${{ matrix.flavor }}-windows-x64-archive
- name: Download Linux x64 kernel (${{ matrix.flavor}})
uses: actions/download-artifact@v4
with:
name: ark-${{ matrix.flavor }}-linux-x64-archive
- name: Download Linux arm64 kernel (${{ matrix.flavor}})
uses: actions/download-artifact@v4
with:
name: ark-${{ matrix.flavor }}-linux-arm64-archive
- name: Upload macOS release artifact (universal)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ark-${{ needs.get_version.outputs.ARK_VERSION }}${{ env.DEBUG_FLAG }}-darwin-universal.zip
asset_name: ark-${{ needs.get_version.outputs.ARK_VERSION }}${{ env.DEBUG_FLAG }}-darwin-universal.zip
asset_content_type: application/octet-stream
- name: Upload Windows release artifact (x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-windows-x64.zip
asset_name: ark-${{ needs.get_version.outputs.ARK_VERSION }}${{ env.DEBUG_FLAG }}-windows-x64.zip
asset_content_type: application/octet-stream
- name: Upload Linux release artifacts (x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-linux-x64.zip
asset_name: ark-${{ needs.get_version.outputs.ARK_VERSION }}${{ env.DEBUG_FLAG }}-linux-x64.zip
asset_content_type: application/octet-stream
- name: Upload Linux release artifacts (arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-linux-arm64.zip
asset_name: ark-${{ needs.get_version.outputs.ARK_VERSION }}${{ env.DEBUG_FLAG }}-linux-arm64.zip
asset_content_type: application/octet-stream
status:
if: ${{ failure() }}
runs-on: ubuntu-latest
needs: [build_macos, build_windows, get_version]
steps:
# - name: Notify slack if build fails
# uses: slackapi/[email protected]
# id: slack-failure
# with:
# payload: |
# {
# "message": "Positron build ${{ needs.get_version.outputs.ARK_VERSION }} failed",
# "status": "Failure",
# "run_url": "https://github.com/posit-dev/positron/actions/runs/${{ github.run_id }}"
# }
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Delete release
with:
release_name: ${{ needs.get_version.outputs.ARK_VERSION }}
tag_name: ${{ needs.get_version.outputs.ARK_VERSION }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release delete ${{ tag_name }} -y --cleanup-tag