Skip to content

GitHub workflows: Update 'actions/checkout' action to v3 #13

GitHub workflows: Update 'actions/checkout' action to v3

GitHub workflows: Update 'actions/checkout' action to v3 #13

name: Build & publish container
on:
push:
branches: [ main ]
workflow_dispatch: {}
concurrency: build
env:
CI_TOOLS_SETUP: https://github.com/SGSGermany/ci-tools/main/setup.sh
defaults:
run:
shell: bash -eu -o pipefail {0}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
OWNER: sgsgermany
IMAGE: archlinux
steps:
- name: Setup CI tools
run: |
. <(curl -fsS -L "$CI_TOOLS_SETUP" | bash -s ~/ci-tools)
echo "CI_TOOLS=$CI_TOOLS" | tee -a "$GITHUB_ENV"
echo "CI_TOOLS_PATH=$CI_TOOLS_PATH" | tee -a "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v3
- name: Log into container registry ${{ env.REGISTRY }}
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate container image tags
run: |
TAGS="latest $(date --utc +'%Y%m%d').$GITHUB_RUN_ID.$GITHUB_RUN_NUMBER"
echo "TAGS=$TAGS" | tee -a "$GITHUB_ENV"
- name: Build container image
run: |
buildah unshare ./build.sh
- name: Container image metadata
run: |
podman image inspect "localhost/$IMAGE:${TAGS%% *}"
- name: Push container image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.IMAGE }}
registry: ${{ env.REGISTRY }}/${{ env.OWNER }}
tags: ${{ env.TAGS }}