Remove version tag prefix #6
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: Build container | |
on: | |
push: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
QEMU_PLATFORMS: "linux/amd64,linux/arm64" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
max-parallel: 2 | |
matrix: | |
tag: ["v2.0", "v2.1", "v2.2", "v2.3", "v2.4", "v2.5", "v2.6", "v2.7", "v2.8", "v2.9"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.tag }} | |
fetch-depth: 0 | |
- name: Log in to the container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
# Add support for more platforms with QEMU | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ env.QEMU_PLATFORMS }} | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Download Dockerfile and install script | |
run: | | |
curl -sL https://raw.githubusercontent.com/unioslo/pg-iam/master/Dockerfile -o Dockerfile | |
curl -sL https://raw.githubusercontent.com/unioslo/pg-iam/master/install.sh -o install.sh | |
- name: Remove tag prefix | |
id: tag | |
run: | | |
export TAG=${{ matrix.tag }} | |
echo "TAG=${TAG:1}" >> $GITHUB_OUTPUT | |
- name: Build and push container image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: ${{ env.QEMU_PLATFORMS }} | |
file: "Dockerfile" | |
push: true | |
tags: ghcr.io/unioslo/pg-iam:${{ steps.tag.outputs.TAG }} |