chore(ci): upgrade docker/setup-buildx-action from v2 to v3 #159
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: Alpine | |
on: | |
push: | |
paths: | |
- .github/workflows/alpine.yml | |
- shell/** | |
- .dockerignore | |
- alpine.Dockerfile | |
pull_request: | |
paths: | |
- .github/workflows/alpine.yml | |
- shell/** | |
- .dockerignore | |
- alpine.Dockerfile | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: "1" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build image | |
run: docker build -f alpine.Dockerfile -t qmcgaw/godevcontainer . | |
publish: | |
if: | | |
github.repository == 'qdm12/godevcontainer' && | |
( | |
github.event_name == 'push' || | |
github.event_name == 'release' || | |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') | |
) | |
needs: [verify] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v2 | |
with: | |
username: qmcgaw | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Set variables | |
id: vars | |
run: | | |
BRANCH=${GITHUB_REF#refs/heads/} | |
TAG=${GITHUB_REF#refs/tags/} | |
echo ::set-output name=commit::$(git rev-parse --short HEAD) | |
echo ::set-output name=created::$(date -u +%Y-%m-%dT%H:%M:%SZ) | |
if [ "$TAG" != "$GITHUB_REF" ]; then | |
echo ::set-output name=version::$TAG | |
echo ::set-output name=alpine_version::$TAG-alpine | |
echo ::set-output name=platforms::linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 | |
elif [ "$BRANCH" = "master" ]; then | |
echo ::set-output name=version::latest | |
echo ::set-output name=alpine_version::alpine | |
echo ::set-output name=platforms::linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 | |
else | |
echo ::set-output name=version::$BRANCH | |
echo ::set-output name=alpine_version::$BRANCH-alpine | |
echo ::set-output name=platforms::linux/amd64 | |
fi | |
- name: Build and push final image | |
uses: docker/build-push-action@v5 | |
with: | |
file: alpine.Dockerfile | |
platforms: ${{ steps.vars.outputs.platforms }} | |
build-args: | | |
CREATED=${{ steps.vars.outputs.created }} | |
COMMIT=${{ steps.vars.outputs.commit }} | |
VERSION=${{ steps.vars.outputs.version }} | |
tags: | | |
qmcgaw/godevcontainer:${{ steps.vars.outputs.version }} | |
qmcgaw/godevcontainer:${{ steps.vars.outputs.alpine_version }} | |
push: true |