Skip to content

chore: fix livery package workflow for staging #15

chore: fix livery package workflow for staging

chore: fix livery package workflow for staging #15

Workflow file for this run

name: staging
on:
push:
tags:
- 'v*-alpha*'
- 'v*-beta*'
- 'v*-rc*'
jobs:
build:
runs-on: ubuntu-latest
env:
A32NX_PRODUCTION_BUILD: 1
A32NX_INSTRUMENTS_BUILD_WORKERS: 2
ZIP_NAME: headwindsim-aircraft-a330-900-staging.zip
RELEASE_ID: 103223112
RELEASE_TAG: vstaging
BUILD_DIR_NAME: staging
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout source
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set BUILT_DATE_TIME
run: echo "BUILT_DATE_TIME=$(date -u -Iseconds)" >> $GITHUB_ENV
- name: Create .env file
run: |
echo A32NX_PRODUCTION_BUILD=1 >> hdw-a339x/.env
echo CLIENT_ID=\"${{ secrets.NAVIGRAPH_CLIENT_ID }}\" >> hdw-a339x/.env
echo CLIENT_SECRET=\"${{ secrets.NAVIGRAPH_CLIENT_SECRET }}\" >> hdw-a339x/.env
echo SENTRY_DSN=\"${{ secrets.SENTRY_DSN }}\" >> hdw-a339x/.env
echo BUILD_DIR_NAME=${{ env.BUILD_DIR_NAME }} >> .env
echo LOCALAZY_READ_KEY=${{ secrets.LOCALAZY_READ_KEY }} >> .env
echo VITE_BUILD=false >> .env
- name: Setup Package
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
- name: Copy Sources
run: |
./scripts/dev-env/run.sh ./scripts/copy_a339x.sh
- name: Build A339X Package
run: |
./scripts/dev-env/run.sh ./scripts/build_a339x.sh --no-tty -j 4
- name: Build ZIP files
run: |
./scripts/dev-env/run.sh node ./scripts/fragment.js
cp ./build-a339x/out/build-modules/modules.json ./build-a339x/out/headwindsim-aircraft-a330-900/install.json
./scripts/dev-env/run.sh node ./scripts/install-source.js
mkdir ./${{ env.BUILD_DIR_NAME }}
cd ./build-a339x/out/
zip -r ../../${{ env.BUILD_DIR_NAME }}/${{ env.ZIP_NAME }} ./headwindsim-aircraft-a330-900/
cd ../../
- name: Delete old vstaging release assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
tag: ${{ env.RELEASE_TAG }}
assets: "*"
fail-if-no-assets: false
- name: Upload zip asset to staging release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}/assets{?name,label}
asset_path: ./${{ env.BUILD_DIR_NAME }}/${{ env.ZIP_NAME }}
asset_name: ${{ env.ZIP_NAME }}
asset_content_type: application/zip
- name: Upload fragment assets to Release
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
release_id: ${{ env.RELEASE_ID }}
assets_path: ./build-a339x/out/build-modules/
- name: Update staging release body
run: |
curl --request PATCH \
--url 'https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}' \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"body": "This pre-release has its asset updated on every staging publish\nLast updated on ${{ env.BUILT_DATE_TIME }} from commit ${{ github.sha }}\nThis link will always point to the latest staging build: https://github.com/${{ github.repository }}/releases/download/${{ env.RELEASE_TAG }}/${{ env.ZIP_NAME }}"
}'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: true
- name: Upload Release asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.BUILD_DIR_NAME }}/${{ env.ZIP_NAME }}
asset_name: ${{ env.ZIP_NAME }}
asset_content_type: application/zip