Merge pull request #6 from esto-openscan/enhance-setup-wizard #23
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 SPA | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "main" | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "build" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: app | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: app/package-lock.json | |
| - name: Install Dependencies | |
| run: | | |
| npm install -g @quasar/cli | |
| npm ci | |
| - name: Build SPA zip | |
| run: npm run build:zip | |
| - name: Compute release name | |
| id: version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| API_VERSION=$(node -p "require('./package.json').apiVersion") | |
| RELEASE_NAME="v${VERSION}+api${API_VERSION}" | |
| echo "release_name=$RELEASE_NAME" >> "$GITHUB_OUTPUT" | |
| - name: Check for duplicate release | |
| env: | |
| RELEASE_NAME: ${{ steps.version.outputs.release_name }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git fetch --tags --force | |
| TAG_EXISTS=$(git rev-parse "$RELEASE_NAME" >/dev/null 2>&1 && echo true || echo false) | |
| RELEASE_EXISTS=$(gh release view "$RELEASE_NAME" >/dev/null 2>&1 && echo true || echo false) | |
| if [ "$TAG_EXISTS" = "true" ] && [ "$RELEASE_EXISTS" = "true" ]; then | |
| echo "::error::Release $RELEASE_NAME already exists. Run 'cd app && npm version <patch|minor|major>' before merging to main." | |
| exit 1 | |
| fi | |
| - name: Publish release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.release_name }} | |
| name: ${{ steps.version.outputs.release_name }} | |
| files: app/dist/spa.zip |