-
Notifications
You must be signed in to change notification settings - Fork 92
182 lines (165 loc) · 6.25 KB
/
build-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
name: "Positron: Build Release"
# Run builds daily at 2am UTC (10p EST) on weekdays for now, or manually
on:
schedule:
- cron: "0 2 * * 1-5"
workflow_dispatch:
jobs:
version_string:
name: Determine version
runs-on: ubuntu-latest
outputs:
short_version: ${{ steps.short_version.outputs.result }}
build_number: ${{ steps.build_number.outputs.result }}
steps:
# Fetch full history; required so we can determine the build version with rev-list
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
# Set up Node; needed since the show-version.js script runs under Node
- uses: actions/setup-node@v3
with:
node-version: 18
# Call version script to determine short version. This is the version
# string that we will use later to form the file name of the release
# artifact.
#
# Example: 2023.12.0-123
- name: Determine Version (Short)
id: short_version
run: |
result=`./versions/show-version.js --short`
echo "result=$result" >> $GITHUB_OUTPUT
# If we're on main, we will be producing a release later, so make sure
# that no release is already in place with this tag
- name: Check for Existing Tag
id: tag_check
if: github.ref == 'refs/heads/main'
run: |
result=`./versions/show-version.js --short`
git fetch --tags
tag_exists=`git tag -l "${result}"`
if [ -n "${tag_exists}" ]; then exit 78; fi
# Call again to get just the build number. Example: 123
- name: Determine Version (Build Number)
id: build_number
run: echo "result=$(./versions/show-version.js --build)" >> $GITHUB_OUTPUT
macos-installer:
uses: ./.github/workflows/build-release-macos.yml
needs: version_string
secrets: inherit
with:
build_number: ${{ needs.version_string.outputs.build_number }}
short_version: ${{ needs.version_string.outputs.short_version }}
windows-installer:
uses: ./.github/workflows/build-release-windows.yml
needs: version_string
secrets: inherit
with:
short_version: ${{ needs.version_string.outputs.short_version }}
linux-binaries:
uses: ./.github/workflows/build-release-linux.yml
needs: version_string
secrets: inherit
with:
short_version: ${{ needs.version_string.outputs.short_version }}
releases:
runs-on: ubuntu-latest
needs: [version_string, macos-installer, windows-installer]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
# Create a GitHub release for the installers we just created, if
# we're running against the main branch
- name: Create release
uses: actions/create-release@v1
id: create_release
if: github.ref == 'refs/heads/main'
with:
draft: false
prerelease: true
release_name: ${{ needs.version_string.outputs.short_version }}
tag_name: ${{ needs.version_string.outputs.short_version }}
macos-releases:
needs: [macos-installer, releases]
runs-on: [self-hosted, macos, arm64]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download MacOS artifact
uses: actions/download-artifact@v4
id: download-macos-artifact
if: github.ref == 'refs/heads/main'
with:
name: ${{ needs.macos-installer.outputs.artifact-name }}
path: ./
- name: Upload MacOS release asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.releases.outputs.upload_url }}
asset_path: ${{ needs.macos-installer.outputs.artifact-file }}
asset_name: ${{ needs.macos-installer.outputs.artifact-file }}
asset_content_type: application/octet-stream
windows-releases:
runs-on:
labels: [windows-latest-8x]
needs: [windows-installer, releases]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download Windows artifact
id: download-windows-artifact
uses: actions/download-artifact@v4
if: github.ref == 'refs/heads/main'
with:
name: ${{ needs.windows-installer.outputs.artifact-name }}
path: ./
- name: Upload Windows release asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.releases.outputs.upload_url }}
asset_path: ${{ needs.windows-installer.outputs.artifact-file }}
asset_name: ${{ needs.windows-installer.outputs.artifact-file }}
asset_content_type: application/octet-stream
linux-releases:
needs: [version_string, linux-binaries, releases]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download Linux artifacts
uses: actions/download-artifact@v4
id: download-linux-artifact
if: github.ref == 'refs/heads/main'
with:
pattern: positron-binary-*
merge-multiple: true
- name: Upload Linux .deb release asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.releases.outputs.upload_url }}
asset_path: Positron-${{ needs.version_string.outputs.short_version }}.deb
asset_name: Positron-${{ needs.version_string.outputs.short_version }}.deb
asset_content_type: application/octet-stream
- name: Upload Linux .rpm release asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.releases.outputs.upload_url }}
asset_path: Positron-${{ needs.version_string.outputs.short_version }}.rpm
asset_name: Positron-${{ needs.version_string.outputs.short_version }}.rpm
asset_content_type: application/octet-stream