feat: new templates #249
This file contains hidden or 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: "Build and deploy bundle" | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_type }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: nixbuild/nix-quick-install-action@v30 | |
| with: | |
| nix_conf: | | |
| substituters = https://cache.nixos.org/ | |
| trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
| keep-env-derivations = true | |
| keep-derivations = true | |
| keep-outputs = true | |
| experimental-features = nix-command flakes | |
| - name: Restore and save Nix store and npm cache | |
| uses: nix-community/cache-nix-action@v6 | |
| with: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('yarn.lock', 'flake.lock') }} | |
| restore-prefixes-first-match: | | |
| nix-${{ runner.os }}- | |
| # do purge caches | |
| purge: true | |
| # purge all versions of the cache | |
| purge-prefixes: nix-${{ runner.os }}- | |
| # except the primary key, if it exists | |
| purge-primary-key: never | |
| # created more than 7 days ago relative to the start of the `Post Restore` phase | |
| purge-created: 604800 | |
| # and collect garbage in the Nix store until it reaches this size in bytes | |
| gc-max-store-size: 8000000000 | |
| - run: | | |
| set -eu | |
| BUNDLE_DIR=$(nix build --no-link --print-out-paths .#) | |
| mkdir output/ | |
| cp -r $BUNDLE_DIR/* output/ | |
| - name: Compute output name | |
| id: vars | |
| shell: bash | |
| run: | | |
| set -eu | |
| # Determine the branch/ref name depending on event type | |
| if [ "${{ github.ref_type }}" = "tag" ]; then | |
| REF="${{ github.ref_name }}" | |
| elif [ "${{ github.event_name }}" = "pull_request" ]; then | |
| REF="${{ github.head_ref }}" | |
| else | |
| REF="${{ github.ref_name }}" | |
| fi | |
| # Normalize branch/ref name | |
| REF_SAFE=$(echo "$REF" \ | |
| | tr '[:upper:]' '[:lower:]' \ | |
| | tr '/' '-' \ | |
| | tr -cs 'a-z0-9._-' '-' \ | |
| | sed 's/^-*//;s/-*$//') | |
| echo "ref=$REF_SAFE" >> "$GITHUB_OUTPUT" | |
| - name: Upload Artifact | |
| if: github.ref_type != 'tag' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coral-console_${{ steps.vars.outputs.ref }} | |
| path: | | |
| ./output/* | |
| - name: Prepare for Release | |
| if: github.ref_type == 'tag' | |
| run: | | |
| set -eu | |
| cd ./output | |
| zip -r ../bundle.zip * | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: github.ref_type == 'tag' | |
| with: | |
| name: coral-console_${{ steps.vars.outputs.ref }}.zip | |
| files: ./bundle.zip |