Skip to content

Commit b0f9f96

Browse files
cI: test vmaster
1 parent 3621ff6 commit b0f9f96

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/master-test.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: vmaster
2+
on:
3+
push:
4+
branches: [linux]
5+
6+
jobs:
7+
build:
8+
# Prevent running this on forks
9+
if: github.repository_owner == 'flybywiresim'
10+
runs-on: ubuntu-22.04
11+
env:
12+
MASTER_PRE_RELEASE_ID: 273592762
13+
MASTER_PRE_RELEASE_TAG: test-linux-vmaster
14+
WINDOWS_ASSET_NAME: FlyByWire_Installer_Setup.exe
15+
steps:
16+
- name: Checkout source
17+
uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
- name: Create .sentrydsn file
22+
run: |
23+
echo ${{ secrets.SENTRY_DSN_INSTALLER }} >> ./extraResources/.sentrydsn
24+
- name: Set BUILT_DATE_TIME
25+
run: echo "BUILT_DATE_TIME=$(date -u -Iseconds)" >> $GITHUB_ENV
26+
- name: Install NPM dependencies
27+
run: npm ci
28+
29+
- name: Install system requirements
30+
run: |
31+
sudo dpkg --add-architecture i386
32+
sudo apt-get update
33+
sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386
34+
sudo apt-get install -y wine32 wine64
35+
sudo apt-get install -y flatpak
36+
sudo apt-get install -y flatpak-builder
37+
- name: Add Flathub Flatpak remote
38+
run: flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
39+
- name: Package installer
40+
run: |
41+
npm run package:all
42+
mkdir -p uploads
43+
cp ./dist/*.exe ./uploads/*.exe
44+
cp ./dist/*.AppImage ./uploads/*.AppImage
45+
cp ./dist/*.rpm ./uploads/*.rpm
46+
cp ./dist/*.deb ./uploads/*.deb
47+
cp ./dist/*.flatpak ./uploads/*.flatpak
48+
cp ./dist/*.snap ./uploads/*.snap
49+
50+
- name: Upload to Bunny CDN (dev)
51+
env:
52+
BUNNY_BUCKET_PASSWORD: ${{ secrets.BUNNY_BUCKET_PASSWORD }}
53+
BUNNY_SECRET_TOKEN: ${{ secrets.BUNNY_SECRET_TOKEN }}
54+
run: ./scripts/cdn.sh uploads/ installer/dev
55+
56+
- name: Upload to CloudFlare CDN (dev)
57+
env:
58+
CLOUDFLARE_BUCKET_PASSWORD: ${{ secrets.CLOUDFLARE_BUCKET_PASSWORD }}
59+
CLOUDFLARE_CDN_ZONE_ID: ${{ secrets.CLOUDFLARE_CDN_ZONE_ID }}
60+
CLOUDFLARE_PURGE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
61+
run: ./scripts/cdn-cf.sh uploads/ installer/dev
62+
63+
- name: Delete previous assets from master pre-release
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
echo 'Fetching all release assets...'
68+
assets=$(curl --location --request GET \
69+
--url https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}/assets \
70+
--header "authorization: Bearer $GITHUB_TOKEN")
71+
asset_ids=$(echo "$assets" | jq '.[].id')
72+
for id in $asset_ids; do
73+
echo "Deleting asset $id"
74+
curl --request DELETE \
75+
--url https://api.github.com/repos/${{ github.repository }}/releases/assets/$id \
76+
--header "authorization: Bearer $GITHUB_TOKEN"
77+
done
78+
- name: Upload binaries to GitHub pre-release assets
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
run: |
82+
for file in uploads/*; do
83+
[ -e "$file" ] || continue
84+
name=$(basename "$file")
85+
echo "Uploading $name"
86+
curl --request POST \
87+
--url "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}/assets?name=$name" \
88+
--header "authorization: Bearer $GITHUB_TOKEN" \
89+
--header "Content-Type: application/octet-stream" \
90+
--data-binary @"$file"
91+
done
92+
- name: Update master pre-release body
93+
run: |
94+
curl --request PATCH \
95+
--url 'https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}' \
96+
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
97+
--header 'Content-Type: application/json' \
98+
--data-raw '{
99+
"body": "This pre-release has its assets updated on every commit to the master branch\nLast updated on ${{ env.BUILT_DATE_TIME }} from commit ${{ github.sha }}\nThis link will always point to the latest Windows master build: https://github.com/${{ github.repository }}/releases/download/${{ env.MASTER_PRE_RELEASE_TAG }}/${{ env.WINDOWS_ASSET_NAME }}"
100+
}'

0 commit comments

Comments
 (0)