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
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -14,48 +16,40 @@ 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
id: metadata
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
Expand All @@ -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
Expand All @@ -77,5 +70,4 @@ jobs:
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
if: ${{ steps.release.outputs.release_created }}


18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion infra/aws-ecs/task_definition_PROD.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@
"value": "Nodewatch"
}
]
}
}