chore: change installer configuration and update URL to Cloudflare (#… #301
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: vmaster | |
on: | |
push: | |
branches: [master] | |
jobs: | |
build: | |
# Prevent running this on forks | |
if: github.repository_owner == 'flybywiresim' | |
runs-on: ubuntu-22.04 | |
env: | |
MASTER_PRE_RELEASE_ID: 36189658 | |
MASTER_PRE_RELEASE_TAG: vmaster | |
ASSET_PATH: dist/FlyByWire_Installer_Setup.exe | |
ASSET_NAME: FlyByWire_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 dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386 && sudo apt-get install -y wine32 wine64 | |
- name: Package installer | |
run: | | |
npm run package && rm -rf ./dist/win-unpacked/ | |
- name: Upload to Bunny CDN (dev) | |
env: | |
BUNNY_BUCKET_PASSWORD: ${{ secrets.BUNNY_BUCKET_PASSWORD }} | |
BUNNY_SECRET_TOKEN: ${{ secrets.BUNNY_SECRET_TOKEN }} | |
run: ./scripts/cdn.sh dist/ installer/dev | |
- name: Upload to CloudFlare CDN (dev) | |
env: | |
CLOUDFLARE_BUCKET_PASSWORD: ${{ secrets.CLOUDFLARE_BUCKET_PASSWORD }} | |
run: ./scripts/cdn-cf.sh dist/ installer/dev | |
- name: Get and delete master 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.MASTER_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.MASTER_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 master pre-release body | |
run: | | |
curl --request PATCH \ | |
--url 'https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_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 master 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 master build: https://github.com/${{ github.repository }}/releases/download/${{ env.MASTER_PRE_RELEASE_TAG }}/${{ env.ASSET_NAME }}" | |
}' |