From fe6c3e229a790d17d5d0d2c6761be0c0c75c9cd2 Mon Sep 17 00:00:00 2001 From: Maxence Maireaux Date: Mon, 5 Jul 2021 21:06:02 +0200 Subject: [PATCH] fix(CI): Improve CI --- .github/workflows/main.yml | 3 +-- .github/workflows/release.yml | 21 +++++++++++++++++++++ .goreleaser.yml | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6bb99b32c..0553f22aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,7 +43,7 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: version: latest - args: build --parallelism 4 --rm-dist --skip-validate + args: build --parallelism 4 --rm-dist --skip-validate --snapshot env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Configure AWS credentials @@ -63,4 +63,3 @@ jobs: run: | docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02162b23e..b317a15b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,3 +41,24 @@ jobs: args: release --parallelism 2 --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-1 + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + - id: get_release + uses: bruceadams/get-release@v1.2.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Build, tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: numary-prod-ecr + IMAGE_TAG: ${{ steps.get_release.outputs.id }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG diff --git a/.goreleaser.yml b/.goreleaser.yml index 27cf511a2..57dbc1b50 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,6 +6,8 @@ builds: - CGO_ENABLED=1 goos: - linux + goarch: + - amd64 binary: numary archives: - replacements: