Skip to content

Commit

Permalink
Merge pull request #9 from jfreeland/tag-container-releases
Browse files Browse the repository at this point in the history
ci: Add a workflow for releasing a tagged container
  • Loading branch information
jfreeland committed Dec 22, 2020
2 parents 414d408 + 47b1cbb commit 9abc14d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This action differs from the build-and-push because it will push a tagged
# container based on conventional commits instead of just always pushing with a
# latest tag. These versioned tags are much more ideal for predictable
# environments and can be used as the `appVersion` in helm charts.
name: Release version tagged container
on:
workflow_dispatch: {}

jobs:
release-container:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
- name: Get latest release
id: latest_version
uses: abatilo/release-info-action@v1.3.0
with:
owner: abatilo
repo: release-info-action

- 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: us-east-1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: public.ecr.aws
ECR_REPOSITORY: z1r6e3l2/jfreeland/ec2-network-monitor
IMAGE_TAG: ${{ steps.latest_version.outputs.latest_tag }}
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/z1r6e3l2
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
6 changes: 6 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
branches:
- name: "main"
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/github"

0 comments on commit 9abc14d

Please sign in to comment.