Merge pull request #11 from ut-code/feature/sidepanel #1
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-publish-zip | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install deps | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Install tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq zip | |
| - name: Resolve version | |
| id: ver | |
| shell: bash | |
| run: | | |
| if [ -f dist/manifest.json ]; then | |
| ver=$(jq -r '.version' dist/manifest.json) | |
| elif [ -f manifest.json ]; then | |
| ver=$(jq -r '.version' manifest.json) | |
| else | |
| ver=$(jq -r '.version' package.json) | |
| fi | |
| echo "version=$ver" >> "$GITHUB_OUTPUT" | |
| - name: Zip dist | |
| run: | | |
| mkdir -p artifacts | |
| cd dist | |
| zip -r "../artifacts/extension-v${{ steps.ver.outputs.version }}.zip" . | |
| cd - | |
| - name: Copy to vulnerable-web/downloads | |
| run: | | |
| mkdir -p vulnerable-web/downloads | |
| cp "artifacts/extension-v${{ steps.ver.outputs.version }}.zip" vulnerable-web/downloads/ | |
| cp "artifacts/extension-v${{ steps.ver.outputs.version }}.zip" vulnerable-web/downloads/latest.zip | |
| - name: Commit zip into repo | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add vulnerable-web/downloads/* | |
| git commit -m "chore: publish extension zip v${{ steps.ver.outputs.version }} [skip ci]" || echo "No changes" | |
| git push | |
| - name: Upload artifact (optional) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: extension-v${{ steps.ver.outputs.version }} | |
| path: artifacts/*.zip |