Merge pull request #20 from ar-io/sync-state-fix #161
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: Build / Test / Push | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
step: ['lint:check', 'test', 'build'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: 'yarn' | |
- run: yarn --immutable --immutable-cache | |
- run: yarn | |
- run: yarn ${{ matrix.step }} | |
push: | |
needs: [build] | |
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push container image to GitHub Container Registry | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
# TODO: add build version node args | |
tags: | | |
ghcr.io/ar-io/ar-io-observer:${{ github.sha }} | |
ghcr.io/ar-io/ar-io-observer:latest | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: [build, push] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
environment: production | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOYMENT_ROLE }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Update Service | |
run: | | |
aws ecs update-service --cluster ${{ secrets.AWS_CLUSTER }} --service ${{ secrets.AWS_SERVICE }} --force-new-deployment --region ${{ secrets.AWS_REGION }} |