From 0868d691097e63f059616ef86229a2f7959d66c0 Mon Sep 17 00:00:00 2001 From: Revyn112 Date: Fri, 13 Oct 2023 21:51:44 +0200 Subject: [PATCH] chore: change to workflows for preview stuff fix fix fix change preview package fix fix workflow fix --- .github/workflows/preview.yml | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 000000000..92dbc9972 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,70 @@ +name: preview +on: + push: + tags: + - 'preview*' + +jobs: + build: + runs-on: ubuntu-latest + env: + A32NX_PRODUCTION_BUILD: 1 + A32NX_INSTRUMENTS_BUILD_WORKERS: 2 + ZIP_NAME: headwindsim-aircraft-a330-900-preview.zip + BUILD_DIR_NAME: staging + CLOUDFLARE_WORKER_PASSWORD: ${{ secrets.CLOUDFLARE_WORKER_PASSWORD }} + CDN_BUCKET_DESTINATION: addons/a339x/preview + 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@v4 + 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 --clean + - 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 Installer fragments + 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: Upload to CloudFlare CDN + run: | + ./scripts/cdn.sh $CDN_BUCKET_DESTINATION ./build-a339x/out/build-modules + - name: Upload Release Config to CloudFlare CDN + run: | + mkdir -p ./build-a339x/out/config + echo "releases:" >> ./build-a339x/out/config/releases.yaml + echo " - name: $GITHUB_REF_NAME" >> ./build-a339x/out/config/releases.yaml + echo " date: $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> ./build-a339x/out/config/releases.yaml + ./scripts/cdn.sh $CDN_BUCKET_DESTINATION ./build-a339x/out/config