Merge pull request #1439 from ko-build/dependabot/go_modules/golang.o… #995
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: Push to registries | |
on: | |
push: | |
branches: | |
- 'main' | |
workflow_dispatch: # Allow manual runs. | |
jobs: | |
quay: | |
name: Push to quay.io | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- env: | |
QUAY_USERNAME: ko-testing+test | |
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} | |
KO_DOCKER_REPO: quay.io/ko-testing/test | |
run: | | |
echo ${QUAY_PASSWORD} | go run ./ login --username=${QUAY_USERNAME} --password-stdin quay.io | |
go run ./ build --platform=all ./test/ --sbom=none --bare | |
dockerhub: | |
name: Push to dockerhub | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- env: | |
DOCKERHUB_USERNAME: kotesting | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
KO_DOCKER_REPO: kotesting/test | |
run: | | |
echo ${DOCKERHUB_PASSWORD} | go run ./ login --username=${DOCKERHUB_USERNAME} --password-stdin index.docker.io | |
go run ./ build --platform=all ./test/ --bare | |
ecr: | |
name: Push to ECR | |
runs-on: ubuntu-latest | |
env: | |
# This is an AWS account that Chainguard provides to enable | |
# go-containerregistry and ko to test ECR support. | |
AWS_ACCOUNT: 479305788615 | |
AWS_REGION: us-west-2 | |
REPOSITORY: ko-ecr-e2e-testing | |
permissions: | |
# This lets us clone the repo | |
contents: read | |
# This lets us mint identity tokens for federation with AWS. | |
id-token: write | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: Install ko | |
run: go install . | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | |
with: | |
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT }}:role/federated-ecr-readwrite | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Test ko build | |
run: | | |
export KO_DOCKER_REPO=${{ env.AWS_ACCOUNT }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.REPOSITORY }} | |
ko build --bare ./test |