Skip to content

Update actions/checkout action to v4 (#474) #293

Update actions/checkout action to v4 (#474)

Update actions/checkout action to v4 (#474) #293

Workflow file for this run

# Summary:
#
# job docker-main-latest:
# * for push to main branch, update "latest" tag
#
# job docker-sha-release-latest:
# * for release, update "latest" tag
# * git ref tag, eg. "sha-ad132f5"
# * release tag major.minor.path, e.g. "1.2.3" (alpine g80)
# * release tag major.minor, e.g. "1.2" (alpine g78)
name: Docker
on:
push:
branches: [main]
tags: ['*.*.*']
paths-ignore: ['docs/**']
release:
types: [published]
env:
# Additionally mentioned in docker-sha-release-latest
# as use of variable fails there
DOCKERHUB_REPOSITORY: mundialis/actinia-core
jobs:
# only run for push to main branch
# take care of latest tag
docker-main-latest:
name: build and push latest for main branch
if: startsWith(github.ref, 'refs/heads/main') && github.repository_owner == 'actinia-org'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- id: meta
name: Create tag name
run: |
tag=${DOCKERHUB_REPOSITORY}:latest
echo "tags=$tag" >> $GITHUB_OUTPUT
- name: log
run: echo ${{ steps.meta.outputs.tags }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
pull: true
context: .
tags: ${{ steps.meta.outputs.tags }}
file: docker/actinia-core-alpine/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
# run always
# On push to branch, take care of sha-ref tag
# On release, take care of latest and release tags
docker-sha-release-latest:
name: build and push release or latest
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'actinia-org'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Create image and tag names
id: meta
uses: docker/metadata-action@v4
with:
# images: ${DOCKERHUB_REPOSITORY}
images: mundialis/actinia-core
tags: |
type=ref,event=tag
type=semver,pattern={{major}}.{{minor}}
type=sha
flavor: |
latest=auto
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
pull: true
context: .
tags: ${{ steps.meta.outputs.tags }}
file: docker/actinia-core-alpine/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}