dataprotector: v2.0.0-beta.21 #3
Workflow file for this run
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: 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 | |
| working-directory: packages/subgraph | |
| 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 }} |