Skip to content

Commit da1ebfb

Browse files
ci: publish subgraph deployer image on dispatch (staging) or release (stable)
1 parent fb2f23f commit da1ebfb

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Subgraph - deployer Docker Image
2+
3+
on:
4+
# For staging releases
5+
workflow_dispatch:
6+
# For latest releases
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
get-version:
12+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref_name,'subgraph-v')) }}
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
- name: compute version
22+
id: compute-publish-version
23+
run: |
24+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
25+
if [ "${{ github.event_name }}" = "release" ]; then
26+
echo "Release detected, setting version to ${CURRENT_VERSION}"
27+
echo "VERSION=${CURRENT_VERSION}" | tee -a $GITHUB_OUTPUT
28+
else
29+
echo "Manual dispatch detected, setting staging version"
30+
BRANCH=$(echo "${{ github.ref_name }}" | sed 's|/|-|g')
31+
COMMIT_SHA="${{ github.sha }}"
32+
echo "VERSION=${CURRENT_VERSION}-${BRANCH}-${COMMIT_SHA::7}" | tee -a $GITHUB_OUTPUT
33+
fi
34+
outputs:
35+
version: ${{ steps.compute-publish-version.outputs.VERSION }}
36+
37+
docker-publish:
38+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref_name,'subgraph-v')) }}
39+
uses: ./.github/workflows/reusable-subgraph-deployer-docker.yml
40+
needs: get-version
41+
with:
42+
tag: ${{ needs.get-version.outputs.version }}
43+
secrets:
44+
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
docker-password: ${{ secrets.DOCKERHUB_PAT }}

0 commit comments

Comments
 (0)