snapshot #515
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: snapshot | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: ["test"] | |
| types: | |
| - completed | |
| branches: | |
| - integration | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| # Only run if tests passed (workflow_run) or manual dispatch | |
| # Also skip release commits to prevent infinite loop | |
| if: | | |
| (github.event_name == 'workflow_dispatch') || | |
| (github.event_name == 'workflow_run' && | |
| github.event.workflow_run.conclusion == 'success' && | |
| !startsWith(github.event.workflow_run.head_commit.message, 'release:') && | |
| !startsWith(github.event.workflow_run.head_commit.message, 'chore:')) | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.PAT_TOKEN }} | |
| # Checkout the branch by name so git branch --show-current works | |
| # For workflow_run, use head_branch; for workflow_dispatch, use ref | |
| ref: ${{ github.event.workflow_run.head_branch || github.ref }} | |
| - run: git fetch --force --tags | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ">=1.24.0" | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| - uses: ./.github/actions/setup-bun | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "shuvcode@latitudes.dev" | |
| git config --global user.name "shuvcode" | |
| - name: Publish | |
| id: publish | |
| run: | | |
| ./script/publish.ts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish Release (undraft) | |
| if: success() && steps.publish.outputs.tagName | |
| run: gh release edit ${{ steps.publish.outputs.tagName }} --draft=false | |
| env: | |
| GH_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| - name: Post to Discord | |
| if: success() && steps.publish.outputs.tagName | |
| continue-on-error: true | |
| run: ./script/discord-notify.ts | |
| env: | |
| DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} | |
| DISCORD_THREAD_ID: ${{ secrets.DISCORD_THREAD_ID }} | |
| RELEASE_VERSION: ${{ steps.publish.outputs.tagName }} | |
| RELEASE_CHANGELOG: ${{ steps.publish.outputs.changelog }} | |
| - name: Deploy Desktop to Cloudflare | |
| continue-on-error: true | |
| run: | | |
| bunx sst deploy --stage production --config sst.desktop.config.ts | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_DEFAULT_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| - name: Deploy Share to Cloudflare | |
| continue-on-error: true | |
| run: | | |
| bunx sst deploy --stage production --config sst.share.config.ts | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_DEFAULT_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
| R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} |