Fix interactive regex_block flow to prompt for pattern (#67) #128
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 Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04-arm | |
| # Native ARM64 runner - no emulation, fast builds | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js 22 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build TypeScript | |
| run: bun run build | |
| - name: Install production dependencies (with Node 22 native modules) | |
| run: | | |
| rm -rf node_modules | |
| npm install --omit=dev | |
| - name: Create release archive | |
| run: | | |
| chmod +x install.sh | |
| chmod +x auto-update.sh | |
| # Version file is always a unix timestamp for reliable comparison in auto-update.sh | |
| date +%s > version.txt | |
| tar -czf cacmin-bot-dist.tar.gz dist/ node_modules/ package.json cacmin-bot.service cacmin-bot-update.service cacmin-bot-update.timer install.sh auto-update.sh version.txt | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cacmin-bot-dist | |
| path: cacmin-bot-dist.tar.gz | |
| retention-days: 90 | |
| - name: Delete old latest release | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| gh release delete latest --yes --cleanup-tag 2>/dev/null || true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create latest release | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| gh release create latest \ | |
| --title "Latest Build" \ | |
| --notes "Build from main @ ${GITHUB_SHA:0:7} ($(date -u '+%Y-%m-%d %H:%M UTC'))" \ | |
| --prerelease \ | |
| cacmin-bot-dist.tar.gz | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create version release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| gh release create "$GITHUB_REF_NAME" \ | |
| --title "$GITHUB_REF_NAME" \ | |
| --generate-notes \ | |
| cacmin-bot-dist.tar.gz | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Deploy to production | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| port: ${{ secrets.DEPLOY_PORT }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_SSH_KEY }} | |
| script: | | |
| /opt/cacmin-bot/auto-update.sh |