Skip to content

chore(actions): use latest Go version #977

chore(actions): use latest Go version

chore(actions): use latest Go version #977

Workflow file for this run

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@v5
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