Skip to content

Update release.yml

Update release.yml #25

Workflow file for this run

name: 'Release'
on:
push:
branches:
- 'main'
permissions:
id-token: write
contents: read
checks: write
jobs:
release:
name: Release
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
master_tag_name: ${{ steps.release_master.outputs.tag_name }}
steps:
- name: Release master
id: release_master
uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # pin@v5.25.0
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
push_to_registry:
name: Push image to ECR
runs-on: ubuntu-latest
needs:
- release
steps:
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2
with:
fetch-depth: 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # pin@v4.0.1
with:
role-to-assume: 'arn:aws:iam::${{ vars.AWS_CICD_ACCOUNT }}:role/ecr-cicd-github'
aws-region: 'us-east-1'
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # pin@v2.0.1
with:
registry-type: public
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # pin@v5.6.1
with:
images: public.ecr.aws/twisto/actions-techdocs
tags: |
type=raw,value=latest
type=raw,value=${{ needs.release.outputs.master_tag_name }}
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # pin@v3.8.0
- name: Build and push Docker image
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # pin@v6.12.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}