Add github actions #1
This file contains 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: Push to AWS ECR (dev) | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
jobs: | |
reservoir-sync-node: | |
name: reservoir-sync-node | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
with: | |
slug-maxlength: 32 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=false | |
images: | | |
${{ steps.login-ecr.outputs.registry }}/github.com/art-technologies/reservoir-sync-node | |
tags: | | |
type=raw,value=${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_NAME_SLUG }}-${{ steps.short-sha.outputs.sha }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
DOCKER_META_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} |