Skip to content

Commit

Permalink
ci(workflow): add support for workflow dispatch deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Oct 30, 2023
1 parent 9890d2f commit bd8c431
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,33 @@ on:
push:
tags: ["v*"]

workflow_dispatch:
inputs:
tag:
description: The version's tag to deploy
required: true
type: string

concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true

jobs:
check-permissions:
if: github.event_name == 'workflow_dispatch' && github.actor != env.AUTH_USER
runs-on: ubuntu-22.04
steps:
- name: Check actor permissions
run: |
echo "Error: Only $AUTH_USER can trigger this workflow."
exit 1
env:
AUTH_USER: "bot-anik"

deploy-on-ipfs:
runs-on: ubuntu-22.04
needs:
- check-permissions
env:
SUBQL_ACCESS_TOKEN: ${{ secrets.SUBQL_ACCESS_TOKEN }}
outputs:
Expand All @@ -23,6 +43,8 @@ jobs:

- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}

- name: Patch startBlock to 1
uses: mikefarah/[email protected]
Expand Down Expand Up @@ -54,7 +76,9 @@ jobs:
deploy-on-subquery-managed-service:
runs-on: ubuntu-22.04
needs: deploy-on-ipfs
needs:
- check-permissions
- deploy-on-ipfs
env:
SUBQL_ACCESS_TOKEN: ${{ secrets.SUBQL_ACCESS_TOKEN }}
IPFS_CID: ${{ needs.deploy-on-ipfs.outputs.ipfs-cid }}
Expand Down

0 comments on commit bd8c431

Please sign in to comment.