diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/build-deploy-prod.yml similarity index 77% rename from .github/workflows/release-deploy.yml rename to .github/workflows/build-deploy-prod.yml index fc85501..4f14a7c 100644 --- a/.github/workflows/release-deploy.yml +++ b/.github/workflows/build-deploy-prod.yml @@ -1,11 +1,13 @@ # Copyright 2020 ChainSafe Systems # SPDX-License-Identifier: LGPL-3.0-only -name: Release +name: Build & Deploy PROD + on: push: - branches: - - main + tags: + - 'v*' + workflow_dispatch: env: AWS_REGION: ${{ secrets.AWS_REGION }} @@ -14,35 +16,29 @@ env: ECS_CLUSTER: ${{ secrets.AWS_ECS_CLUSTER }} ECS_SERVICE: ${{ secrets.AWS_ECS_SERVICE }} ENVIRONMENT: PROD - + jobs: - release-please: + build: + name: build_deploy_prod runs-on: ubuntu-latest permissions: id-token: write contents: write steps: - - uses: GoogleCloudPlatform/release-please-action@v3.1 - id: release - with: - release-type: go - + # download the source code into the runner - name: checkout uses: actions/checkout@v2 - if: ${{ steps.release.outputs.release_created }} - + - name: Set output id: vars run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} - if: ${{ steps.release.outputs.release_created }} - + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/github-actions-role aws-region: ${{ env.AWS_REGION }} - if: ${{ steps.release.outputs.release_created }} # gather metadata from git & github actions to reference in docker - name: git & github metadata @@ -50,12 +46,10 @@ jobs: uses: docker/metadata-action@v3 with: images: ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AWS_ECR_REPO }} - if: ${{ steps.release.outputs.release_created }} # login in docker repository - name: docker login uses: aws-actions/amazon-ecr-login@v1 - if: ${{ steps.release.outputs.release_created }} # build a docker image - name: docker & push image @@ -67,8 +61,7 @@ jobs: tags: | ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:latest ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:${{ steps.vars.outputs.tag }} - if: ${{ steps.release.outputs.release_created }} - + # deploy to AWS ECS - name: Deploy to Amazon ECS uses: aws-actions/amazon-ecs-deploy-task-definition@v1 @@ -77,5 +70,4 @@ jobs: service: ${{ env.ECS_SERVICE }} cluster: ${{ env.ECS_CLUSTER }} wait-for-service-stability: true - if: ${{ steps.release.outputs.release_created }} - + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..11fc62b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,18 @@ +# Copyright 2020 ChainSafe Systems +# SPDX-License-Identifier: LGPL-3.0-only + +name: Release +on: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v3.1 + id: release + with: + release-type: go + diff --git a/infra/aws-ecs/task_definition_PROD.json b/infra/aws-ecs/task_definition_PROD.json index ed61549..8edd87d 100644 --- a/infra/aws-ecs/task_definition_PROD.json +++ b/infra/aws-ecs/task_definition_PROD.json @@ -99,4 +99,4 @@ "value": "Nodewatch" } ] -} \ No newline at end of file +}