Merge pull request #607 from prymitive/go-mod-upgrades #1034
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set git slug envs | |
uses: rlespinasse/github-slug-action@v4.5.0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: github.event_name == 'release' | |
uses: docker/login-action@v3 | |
with: | |
username: lmierzwa | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
if: github.event_name == 'release' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_PKG_TOKEN }} | |
- name: "Setup docker tags (latest + vX.Y)" | |
if: github.event_name == 'release' | |
run: | | |
echo 'DOCKER_TAGS<<EOF' >> $GITHUB_ENV | |
echo 'lmierzwa/kthxbye:${{ env.GITHUB_REF_SLUG }}' >> $GITHUB_ENV | |
echo 'lmierzwa/kthxbye:latest' >> $GITHUB_ENV | |
echo 'ghcr.io/prymitive/kthxbye:${{ env.GITHUB_REF_SLUG }}' >> $GITHUB_ENV | |
echo 'ghcr.io/prymitive/kthxbye:latest' >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: "Setup docker tags (latest)" | |
if: github.event_name != 'release' | |
run: | | |
echo 'DOCKER_TAGS<<EOF' >> $GITHUB_ENV | |
echo 'lmierzwa/kthxbye:latest' >> $GITHUB_ENV | |
echo 'ghcr.io/prymitive/kthxbye:latest' >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name == 'release' }} | |
tags: ${{ env.DOCKER_TAGS }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |