Deploy Demo #36
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: Deploy Demo | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: ["Publish"] | |
| types: [completed] | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get version from package.json | |
| id: version | |
| run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT | |
| - name: Update image tag in wrangler.toml | |
| run: sed -i "s|pgplex/pgconsole:[^ \"]*|pgplex/pgconsole:${{ steps.version.outputs.VERSION }}|" worker/demo/wrangler.toml | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| working-directory: worker/demo | |
| - name: Pull from Docker Hub and push to Cloudflare registry | |
| run: | | |
| docker pull pgplex/pgconsole:${{ steps.version.outputs.VERSION }} | |
| docker tag pgplex/pgconsole:${{ steps.version.outputs.VERSION }} pgplex/pgconsole:${{ steps.version.outputs.VERSION }} | |
| pnpm wrangler containers push pgplex/pgconsole:${{ steps.version.outputs.VERSION }} | |
| working-directory: worker/demo | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| - name: Deploy to Cloudflare | |
| run: pnpm wrangler deploy | |
| working-directory: worker/demo | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |