Skip to content

chore(deps): update dependency golang/go to v1.23.5 #121

chore(deps): update dependency golang/go to v1.23.5

chore(deps): update dependency golang/go to v1.23.5 #121

Workflow file for this run

name: CI/CD
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]
workflow_run:
workflows: ["Weekly Tag"]
types:
- completed
jobs:
lint-and-test:
name: Lint and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
# renovate: datasource=github-tags depName=golang/go
go-version: "1.23.5"
- name: Print Go version
run: go version
- name: Run golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6
with:
# renovate: datasource=github-releases depName=golangci/golangci-lint
version: v1.62.2
- name: Run tests
run: go test -v ./...
build:
name: Build Binaries and Docker Images
needs: lint-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
# renovate: datasource=github-tags depName=golang/go
go-version: "1.23.5"
- name: Set git variables
id: git_vars
run: |
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "GIT_REF=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Build binaries
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.gitHash=${{ steps.git_vars.outputs.GIT_HASH }} -X main.gitRef=${{ steps.git_vars.outputs.GIT_REF }}" -o aws-ecr-auth-proxy-amd64 ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-X main.gitHash=${{ steps.git_vars.outputs.GIT_HASH }} -X main.gitRef=${{ steps.git_vars.outputs.GIT_REF }}" -o aws-ecr-auth-proxy-arm64 ./cmd/main.go
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
- name: Test binaries
run: |
chmod +x aws-ecr-auth-proxy-amd64
chmod +x aws-ecr-auth-proxy-arm64
./aws-ecr-auth-proxy-amd64 version
docker run --rm -v $(pwd):/workspace -w /workspace --platform linux/arm64 alpine ./aws-ecr-auth-proxy-arm64 version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
- name: Build Docker images
run: |
# Build AMD64 image
docker buildx build --platform linux/amd64 \
-t aws-ecr-auth-proxy:test-amd64 \
--build-arg ARCH=amd64 \
-f Dockerfile \
--load .
# Build ARM64 image
docker buildx build --platform linux/arm64 \
-t aws-ecr-auth-proxy:test-arm64 \
--build-arg ARCH=arm64 \
-f Dockerfile \
--load .
- name: Test Docker images
run: |
docker run --rm aws-ecr-auth-proxy:test-amd64 /app/aws-ecr-auth-proxy version
docker run --rm --platform linux/arm64 aws-ecr-auth-proxy:test-arm64 /app/aws-ecr-auth-proxy version
- name: Upload binaries
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: binaries
path: |
aws-ecr-auth-proxy-amd64
aws-ecr-auth-proxy-arm64
- name: Save Docker images
run: |
docker save aws-ecr-auth-proxy:test-amd64 > aws-ecr-auth-proxy-amd64.tar
docker save aws-ecr-auth-proxy:test-arm64 > aws-ecr-auth-proxy-arm64.tar
- name: Upload Docker images
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: docker-images
path: |
aws-ecr-auth-proxy-amd64.tar
aws-ecr-auth-proxy-arm64.tar
release:
name: Create Release
needs: build
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
(github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Weekly Tag' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Determine version number
id: version
run: |
if [[ ${{ github.event_name }} == 'push' && ${{ github.ref }} == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
git fetch --tags
VERSION=$(git describe --tags --abbrev=0)
VERSION=${VERSION#v}
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Download binaries
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: binaries
- name: Download Docker images
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: docker-images
- name: Create Release
id: create_release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.VERSION }}
release_name: Release v${{ steps.version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload AMD64 Asset
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./aws-ecr-auth-proxy-amd64
asset_name: aws-ecr-auth-proxy-amd64-v${{ steps.version.outputs.VERSION }}
asset_content_type: application/octet-stream
- name: Upload ARM64 Asset
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./aws-ecr-auth-proxy-arm64
asset_name: aws-ecr-auth-proxy-arm64-v${{ steps.version.outputs.VERSION }}
asset_content_type: application/octet-stream
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push and create multi-arch Docker images
env:
DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/aws-ecr-auth-proxy
run: |
docker load < aws-ecr-auth-proxy-amd64.tar
docker load < aws-ecr-auth-proxy-arm64.tar
docker tag aws-ecr-auth-proxy:test-amd64 $DOCKER_REPO:v${{ steps.version.outputs.VERSION }}-amd64
docker tag aws-ecr-auth-proxy:test-amd64 $DOCKER_REPO:latest-amd64
docker tag aws-ecr-auth-proxy:test-arm64 $DOCKER_REPO:v${{ steps.version.outputs.VERSION }}-arm64
docker tag aws-ecr-auth-proxy:test-arm64 $DOCKER_REPO:latest-arm64
docker push $DOCKER_REPO:v${{ steps.version.outputs.VERSION }}-amd64
docker push $DOCKER_REPO:latest-amd64
docker push $DOCKER_REPO:v${{ steps.version.outputs.VERSION }}-arm64
docker push $DOCKER_REPO:latest-arm64
docker manifest create $DOCKER_REPO:v${{ steps.version.outputs.VERSION }} \
$DOCKER_REPO:v${{ steps.version.outputs.VERSION }}-amd64 \
$DOCKER_REPO:v${{ steps.version.outputs.VERSION }}-arm64
docker manifest push $DOCKER_REPO:v${{ steps.version.outputs.VERSION }}
docker manifest create $DOCKER_REPO:latest \
$DOCKER_REPO:latest-amd64 \
$DOCKER_REPO:latest-arm64
docker manifest push $DOCKER_REPO:latest