Skip to content

Merge pull request #7 from tosuke/fix-role-session-name #5

Merge pull request #7 from tosuke/fix-role-session-name

Merge pull request #7 from tosuke/fix-role-session-name #5

Workflow file for this run

---
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
role-session-name: "mackerel-sql-metric-collector-${{ github.run_id }}-${{ github.run_number }}"
aws-region: ap-northeast-1
- name: Login to Public ECR
uses: docker/login-action@v3
with:
registry: public.ecr.aws
env:
AWS_REGION: us-east-1
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
public.ecr.aws/mackerel/mackerel-sql-metric-collector
tags: |
type=semver,pattern={{raw}}
- name: Get short sha
id: short-sha
run: echo "GIT_SHORT_SHA=${GITHUB_SHA:0:7}" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
provenance: false
file: Dockerfile
platforms: |
linux/amd64
linux/arm64
build-args: |
GIT_REVISION=${{ steps.short-sha.outputs.GIT_SHORT_SHA }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}