Update Go version (#5097) #79
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: "apkbuild" | |
concurrency: | |
group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- apk/** | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- apk/** | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# These versions must be strings. E.g. Otherwise `3.10` -> `3.1` | |
alpine: | |
- 'alpine' | |
steps: | |
- name: "Checkout source code at current commit" | |
uses: actions/checkout@v4 | |
- name: Prepare tags for Docker image | |
id: prepare | |
env: | |
BUILDER: apkbuild | |
MATRIX_TAG: ${{matrix.alpine}} | |
run: | | |
DOCKER_IMAGE=ghcr.io/${{ github.repository }}-${BUILDER} | |
TAGS="${DOCKER_IMAGE}:${MATRIX_TAG},${DOCKER_IMAGE}:latest" | |
COMMIT_SHA="${GITHUB_SHA}" | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
elif [[ $GITHUB_REF == refs/pull/* ]]; then | |
VERSION=pr-${{ github.event.pull_request.number }} | |
COMMIT_SHA=${{ github.event.pull_request.head.sha }} | |
fi | |
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${COMMIT_SHA:0:7}" | |
if [[ -n $VERSION ]]; then | |
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}" | |
fi | |
echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: "${{ github.actor }}" | |
password: "${{ secrets.GITHUB_TOKEN }}" | |
- name: "Build and push APK builder docker image to DockerHub" | |
id: docker_build_builder | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
provenance: false | |
tags: ${{ steps.prepare.outputs.tags }} | |
file: apk/Dockerfile-${{matrix.alpine}} |