gha: update to use oidc #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: docker-image | |
on: | |
push: | |
tags: ['*'] | |
branches: ['master'] | |
paths-ignore: ['charts/**'] | |
pull_request: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ${{ vars.RP_AWS_CRED_REGION }} | |
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }} | |
- uses: aws-actions/aws-secretsmanager-get-secrets@v2 | |
with: | |
secret-ids: | | |
,sdlc/prod/github/dockerhub_token | |
parse-json-secrets: true | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: image=moby/buildkit:v0.15.2,network=host | |
- name: Set build date | |
run: | | |
echo "BUILT_AT=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- uses: docker/metadata-action@v5 | |
id: docker_meta | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
vectorized/kminion | |
redpandadata/kminion | |
# generate Docker tags based on the following events/attributes | |
# Semver type is only active on 'push tag' events, | |
# hence no enable condition required | |
tags: | | |
type=sha,prefix={{branch}}-,format=short,enable={{is_default_branch}} | |
type=semver,pattern={{raw}} | |
- uses: docker/login-action@v3 | |
with: | |
username: vectorizedbot | |
password: ${{ env.DOCKERHUB_TOKEN }} | |
- uses: docker/build-push-action@v6 | |
with: | |
provenance: false | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
build-args: | | |
VERSION=${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
BUILT_AT=${{ env.BUILT_AT }} | |
COMMIT=${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |