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
84 changes: 84 additions & 0 deletions .github/workflows/build-publish-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and publish image to Docker Hub and ECR

on:
push:
tags:
- v*
release:
types: [published]

permissions:
id-token: write
contents: read

env:
AWS_REGION: us-west-2
ECR_REPOSITORY: polymesh/polymesh-subquery

jobs:
publish:
name: Build and push image
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out the repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0

- name: Enable corepack
run: corepack enable

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22.x'
cache: 'yarn'

- name: install dependencies
run: yarn --immutable

- name: Set package version
run: yarn set-version

- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0

- name: Log in to Docker Hub
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
username: ${{ secrets.ASSOCIATION_DOCKER_USERNAME }}
password: ${{ secrets.ASSOCIATION_DOCKER_TOKEN }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1
with:
role-to-assume: ${{ vars.ECR_PUSH_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}

- name: Log in to Amazon ECR
id: ecr-login
uses: aws-actions/amazon-ecr-login@d539f0932e70871a027e9d5a9d8fc38589180a64 # v2.1.6

- name: Extract metadata (tags, labels) for Docker Hub
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ secrets.ASSOCIATION_DOCKER_HUB_REPO }}

- name: Build and push image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: ./docker/sq-Dockerfile
platforms: linux/amd64,linux/arm64
push: true
provenance: true
sbom: true
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.ecr-login.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.ref_name }}
${{ steps.ecr-login.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
58 changes: 0 additions & 58 deletions .github/workflows/docker-image.yml

This file was deleted.

Loading