lastsunday extension build #405
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-extension | |
| run-name: ${{ github.actor }} extension build | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| tags: | |
| - "@job-hunting/extension@*" | |
| paths: | |
| - "apps/extension/**" | |
| - "libs/**" | |
| - ".github/**" | |
| - "pnpm-lock.yaml" | |
| pull_request: | |
| branches: | |
| - dev | |
| paths: | |
| - "apps/extension/**" | |
| - "libs/**" | |
| - ".github/**" | |
| - "pnpm-lock.yaml" | |
| env: | |
| ROOT_DIR: apps/extension/ | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-extension: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set Version Env | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| echo "VERSION=$(echo '${{ github.ref_name }}' | sed -e 's/\@job-hunting\/extension\@//g')" >> $GITHUB_ENV | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda | |
| name: Install pnpm | |
| with: | |
| version: 10.13.1 | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 | |
| with: | |
| node-version: 22.17.1 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run unit tests | |
| run: | | |
| pnpm exec nx run @job-hunting/extension:test:unit | |
| - name: Zip extensions | |
| run: | | |
| pnpm install | |
| pnpm exec nx run @job-hunting/extension:zip | |
| pnpm exec nx run @job-hunting/extension:zip:firefox | |
| - name: Setup e2e tests | |
| run: | | |
| pnpm exec nx run @job-hunting/extension:test:e2e:install | |
| - name: Run e2e tests | |
| run: | | |
| pnpm exec nx run @job-hunting/extension:test:e2e | |
| - name: (cucumber-report)Upload test report to action artifacts | |
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: extension-e2e-tests-cucumber-report | |
| path: ${{ env.ROOT_DIR }}cucumber-report/ | |
| retention-days: 30 | |
| - name: (allure-report)Set up JDK | |
| uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 | |
| if: ${{ !cancelled() }} | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| - name: (allure-report)Load test report history | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
| if: ${{ !cancelled() }} | |
| continue-on-error: true | |
| with: | |
| ref: gh-pages | |
| path: gh-pages | |
| - name: (allure-report)Build test report | |
| uses: simple-elf/allure-report-action@f841fec0e421b5d7d8e807dedfb03efb8cf30303 | |
| if: ${{ !cancelled() }} | |
| with: | |
| gh_pages: gh-pages | |
| allure_history: gh-pages | |
| allure_results: ${{ env.ROOT_DIR }}allure-results | |
| - name: (allure-report)Upload test report to action artifacts | |
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: extension-e2e-tests-allure-report | |
| path: allure-report/ | |
| retention-days: 30 | |
| - name: (allure-report)Publish test report to gh-pages | |
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e | |
| if: ${{ (github.event_name != 'pull_request') && !cancelled()}} | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: gh-pages | |
| - name: Rename dist files | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| CHROME_ZIP=$(ls ${{ env.ROOT_DIR }}.output/job-huntingextension-*-chrome.zip) | |
| FIREFOX_ZIP=$(ls ${{ env.ROOT_DIR }}.output/job-huntingextension-*-firefox.zip) | |
| mv "$CHROME_ZIP" ${{ env.ROOT_DIR }}.output/job-hunting-extension-chrome-${{ env.VERSION }}.zip | |
| mv "$FIREFOX_ZIP" ${{ env.ROOT_DIR }}.output/job-hunting-extension-firefox-${{ env.VERSION }}.zip | |
| - name: Deploy chrome dist branch | |
| uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 | |
| with: | |
| branch: dist/chrome-${{ github.ref_name }} | |
| folder: ${{ env.ROOT_DIR }}.output/chrome-mv3 | |
| if: github.event_name != 'pull_request' | |
| - name: Deploy firefox dist branch | |
| uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 | |
| with: | |
| branch: dist/firefox-${{ github.ref_name }} | |
| folder: ${{ env.ROOT_DIR }}.output/firefox-mv2 | |
| if: github.event_name != 'pull_request' | |
| - name: Gen latest changelog | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| awk '/^##[^#]/{print NR}' ${{ env.ROOT_DIR }}CHANGELOG.md | head -n 2 | xargs | tr ' ' ',' | xargs -I {} sed -n {}p ${{ env.ROOT_DIR }}CHANGELOG.md | sed '$d' > ${{ env.ROOT_DIR }}CHANGELOG.txt | |
| - name: Release | |
| uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| body_path: ${{ env.ROOT_DIR }}CHANGELOG.txt | |
| make_latest: true | |
| files: | | |
| ${{ env.ROOT_DIR }}.output/job-hunting-extension-chrome-${{ env.VERSION }}.zip | |
| ${{ env.ROOT_DIR }}.output/job-hunting-extension-firefox-${{ env.VERSION }}.zip |