Develop #2307
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 Frontend | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| branches: ['main'] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22.x, 24.x] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Cache npm dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-${{ matrix.node-version }}- | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Get version from package.json | |
| if: github.event_name == 'workflow_dispatch' && matrix.node-version == '20.x' | |
| id: get_version | |
| run: | | |
| version=$(node -p "require('./package.json').version") | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - name: Generate Release Notes | |
| if: github.event_name == 'workflow_dispatch' && matrix.node-version == '20.x' | |
| id: release_notes | |
| run: | | |
| # Get the previous tag | |
| previous_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -z "$previous_tag" ]; then | |
| # If no previous tag, get all commits | |
| git log --pretty=format:"* %s (%h)" > release_notes.txt | |
| else | |
| # Get commits since last tag | |
| git log --pretty=format:"* %s (%h)" $previous_tag..HEAD > release_notes.txt | |
| fi | |
| # Read the content and escape it for GitHub Actions | |
| notes=$(cat release_notes.txt) | |
| echo "notes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$notes" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Zip dist folder | |
| if: github.event_name == 'workflow_dispatch' && matrix.node-version == '20.x' | |
| run: | | |
| cd dist | |
| zip -r ../${{ steps.get_version.outputs.version }}.zip . | |
| - name: Zip wait-for-app-html folder | |
| if: github.event_name == 'workflow_dispatch' && matrix.node-version == '20.x' | |
| run: | | |
| cd scripts/wait-for-app-html | |
| zip -r ../../wait-for-app-html.zip . | |
| - name: Create Release | |
| if: github.event_name == 'workflow_dispatch' && matrix.node-version == '20.x' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: 'v${{ steps.get_version.outputs.version }}' | |
| name: 'Release ${{ steps.get_version.outputs.version }}' | |
| body: ${{ steps.release_notes.outputs.notes }} | |
| files: | | |
| ${{ steps.get_version.outputs.version }}.zip | |
| wait-for-app-html.zip | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |