-
-
Notifications
You must be signed in to change notification settings - Fork 25
175 lines (143 loc) · 4.62 KB
/
build-nightly.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
name: ezytdl nightly distributable build
run-name: ${{ github.actor }} - ${{ github.event_name }} - ${{ github.sha }}
on:
schedule:
- cron: "0 11 * * *" # 6am cst (i'll probably be asleep and have pushed a working change by then)
workflow_dispatch:
inputs:
notes:
description: "Release notes"
required: false
default: ''
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ env.should_run }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- id: should_run
continue-on-error: true
name: check if there have been more than 0 commits since last tag
run: |
commits_since_last_tag=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
echo "$commits_since_last_tag commits since last tag"
echo "should_run=$(if (( $commits_since_last_tag > 0 )); then echo "true"; else echo "false"; fi)" >> "$GITHUB_ENV"
release_info:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
name: Create release tag
permissions: write-all
outputs:
release_id: ${{ steps.create_release.outputs.id }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get release metadata
id: get_release_metadata
run: |
echo "TAG_NAME=$(node -e "console.log(require('./package.json').version)")-dev.${{github.run_number}}" >> "$GITHUB_ENV"
echo "RELEASE_NAME=[DEV] $(node -e "console.log(require('./package.json').version)")-dev.${{github.run_number}}" >> "$GITHUB_ENV"
echo "BODY_PATH=$(echo "$(pwd)/release-notes.md")" >> "$GITHUB_ENV"
- name: Create release notes
id: create_notes
run: |
node devscripts/generateReleaseNotes.js nightly ${{ github.event.inputs.notes }}
- name: Create pre-release draft
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.TAG_NAME }}
name: ${{ env.RELEASE_NAME }}
commit: ${{ github.sha }}
draft: true
prerelease: true
makeLatest: false
bodyFile: ${{ env.BODY_PATH }}
omitBody: false
omitBodyDuringUpdate: true
linux-dist:
needs: release_info
runs-on: ubuntu-22.04
permissions: write-all
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Node.js & NPM
uses: actions/setup-node@main
with:
node-version: "18"
- name: Install npm deps
run: |
npm install
- name: Build app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run nightly -- --build-number ${{github.run_number}}
macos-dist:
needs: release_info
runs-on: macos-latest
permissions: write-all
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Node.js & NPM
uses: actions/setup-node@main
with:
node-version: "18"
- name: Install npm deps
run: |
npm install
- name: Build app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run nightly -- --build-number ${{github.run_number}}
windows-dist:
needs: release_info
runs-on: windows-latest
permissions: write-all
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Node.js & NPM
uses: actions/setup-node@main
with:
node-version: "18"
- name: Install npm deps
run: |
npm install
- name: Build app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run nightly -- --build-number ${{github.run_number}}
release:
needs: [linux-dist, macos-dist, windows-dist, release_info]
name: "Release the build"
runs-on: "ubuntu-latest"
permissions: write-all
steps:
- name: Publish
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.release_info.outputs.release_id }}
- name: Delete older nightly builds
uses: dev-drprasad/[email protected]
with:
keep_latest: 3
delete_tags: true
delete_tag_pattern: dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}