Refactor desktop build workflow to use dynamic versioning and improve… #635
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: Web Build and Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Version | |
| run: | | |
| BASE_VERSION=$(npm run get-version --silent) | |
| # Remove last digit and dot, then append run number | |
| VERSION=$(echo $BASE_VERSION | sed 's/\.[0-9]*$/.'${{ github.run_number }}/) | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Update package.json version | |
| run: npm version $VERSION --no-git-tag-version | |
| shell: bash | |
| - name: Install dependencies | |
| run: npm install --force | |
| - name: Build | |
| run: npm run build | |
| - name: Copy index.html to 404.html | |
| run: cp dist/browser/index.html dist/browser/404.html | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v3 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './dist/browser' | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 |