chore: update dependencies (#18) #3
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: Publish release-build branch | |
| on: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: release-build | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Prepare artifacts | |
| id: prep | |
| shell: bash | |
| env: | |
| ART_DIR: ${{ runner.temp }}/release-build | |
| run: | | |
| set -euo pipefail | |
| SHORT_SHA="$(git rev-parse --short HEAD)" | |
| rm -rf "$ART_DIR" | |
| mkdir -p "$ART_DIR" | |
| cp -R dist "$ART_DIR/" | |
| node -e " | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); | |
| delete pkg.scripts; | |
| delete pkg.devDependencies; | |
| fs.writeFileSync(process.env.ART_DIR + '/package.json', JSON.stringify(pkg, null, 2)); | |
| " | |
| [ -f README.md ] && cp README.md "$ART_DIR/" || true | |
| [ -f LICENSE ] && cp LICENSE "$ART_DIR/" || true | |
| [ -f CHANGELOG.md ] && cp CHANGELOG.md "$ART_DIR/" || true | |
| echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" | |
| echo "art_dir=$ART_DIR" >> "$GITHUB_OUTPUT" | |
| - name: Publish to release-build branch | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ART_DIR: ${{ steps.prep.outputs.art_dir }} | |
| SHORT_SHA: ${{ steps.prep.outputs.short_sha }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cd "$ART_DIR" | |
| git init | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "chore: release build for ${SHORT_SHA}" | |
| git branch -M release-build | |
| git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
| git push --force origin release-build |