Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/reusable-subgraph-deployer-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: docker workflow for dataprotector subgraph deployer

on:
workflow_call:
inputs:
dry-run:
description: 'Run in dry-run mode (the docker image will not be published)'
default: false
type: boolean
tag:
description: 'Tag of Docker Image'
default: 'latest'
type: string
secrets:
docker-username:
description: 'Docker registry username (required unless `dry-run: true`)'
required: false
docker-password:
description: 'Docker registry password or PAT (required unless `dry-run: true`)'
required: false

jobs:
docker-publish:
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
with:
image-name: 'iexechub/dataprotector-subgraph-deployer'
registry: 'docker.io'
dockerfile: 'packages/subgraph/deployer.Dockerfile'
context: 'packages/subgraph'
security-scan: true
security-report: 'sarif'
hadolint: true
push: ${{ !inputs.dry-run }}
image-tag: ${{ inputs.tag }}
secrets:
username: ${{ secrets.docker-username }}
password: ${{ secrets.docker-password }}
5 changes: 5 additions & 0 deletions .github/workflows/subgraph-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ jobs:
- name: Build
working-directory: packages/subgraph
run: npm run build

deployer-docker-dry-run:
uses: ./.github/workflows/reusable-subgraph-deployer-docker.yml
with:
dry-run: true
45 changes: 45 additions & 0 deletions .github/workflows/subgraph-deployer-publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Subgraph - deployer Docker Image

on:
# For staging releases
workflow_dispatch:
# For latest releases
release:
types: [published]

jobs:
get-version:
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref_name,'subgraph-v')) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: compute version
id: compute-publish-version
run: |
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
if [ "${{ github.event_name }}" = "release" ]; then
echo "Release detected, setting version to ${CURRENT_VERSION}"
echo "VERSION=${CURRENT_VERSION}" | tee -a $GITHUB_OUTPUT
else
echo "Manual dispatch detected, setting staging version"
BRANCH=$(echo "${{ github.ref_name }}" | sed 's|/|-|g')
COMMIT_SHA="${{ github.sha }}"
echo "VERSION=${CURRENT_VERSION}-${BRANCH}-${COMMIT_SHA::7}" | tee -a $GITHUB_OUTPUT
fi
outputs:
version: ${{ steps.compute-publish-version.outputs.VERSION }}

docker-publish:
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref_name,'subgraph-v')) }}
uses: ./.github/workflows/reusable-subgraph-deployer-docker.yml
needs: get-version
with:
tag: ${{ needs.get-version.outputs.version }}
secrets:
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
docker-password: ${{ secrets.DOCKERHUB_PAT }}
2 changes: 1 addition & 1 deletion packages/subgraph/deployer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.18
FROM node:20

RUN mkdir /app

Expand Down
Loading