-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (75 loc) · 3.4 KB
/
master.yaml
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
name: vmain
on:
push:
branches: [main]
jobs:
build:
# Prevent running this on forks
if: github.repository_owner == 'headwindsim'
runs-on: ubuntu-latest
env:
MAIN_PRE_RELEASE_ID: 101378539
MAIN_PRE_RELEASE_TAG: vmain
ASSET_PATH: dist/Headwind_Installer_Setup.exe
ASSET_NAME: Headwind_Installer_Setup.exe
steps:
- name: Checkout source
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.9'
- name: Create .sentrydsn file
run: |
echo ${{ secrets.SENTRY_DSN_INSTALLER }} >> ./extraResources/.sentrydsn
- name: Set BUILT_DATE_TIME
run: echo "BUILT_DATE_TIME=$(date -u -Iseconds)" >> $GITHUB_ENV
- name: Install NPM dependencies
run: npm ci
- name: Install system requirements
run: |
sudo eatmydata apt-get install ppa-purge
sudo eatmydata ppa-purge -y ppa:ubuntu-toolchain-r/test
sudo dpkg --add-architecture i386
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive eatmydata apt install -y --no-install-recommends wine-stable wine32 wine64
- name: Package installer
run: |
npm run package && rm -rf ./dist/win-unpacked/
- name: Upload to CloudFlare CDN (dev)
env:
CLOUDFLARE_WORKER_PASSWORD: ${{ secrets.CLOUDFLARE_WORKER_PASSWORD }}
run: ./scripts/cdn-cf.sh installer/dev ./dist
- name: Get and delete main pre-release zip asset
run: |
echo 'checking for first release asset...'
assets=$( \
curl --location --request GET \
--url https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MAIN_PRE_RELEASE_ID }}/assets
)
if [ $(echo $assets | jq '.[0].size') -eq '0' ]; then
echo 'no asset to delete'
else
assetId=$(echo $assets | jq '.[0].id')
echo 'deleting asset '$assetId
curl --request DELETE \
--url https://api.github.com/repos/${{ github.repository }}/releases/assets/$assetId \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
fi
- name: Upload release binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.MAIN_PRE_RELEASE_ID }}/assets{?name,label}
asset_path: ${{ env.ASSET_PATH }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: application/x-msdos-program
- name: Update main pre-release body
run: |
curl --request PATCH \
--url 'https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MAIN_PRE_RELEASE_ID }}' \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"body": "This pre-release has its ${{ env.ASSET_NAME }} asset updated on every commit to the main branch\nDo not use the source code assets, they are never updated\nLast updated on ${{ env.BUILT_DATE_TIME }} from commit ${{ github.sha }}\nThis link will always point to the latest main build: https://github.com/${{ github.repository }}/releases/download/${{ env.MAIN_PRE_RELEASE_TAG }}/${{ env.ASSET_NAME }}"
}'