Skip to content

4.0.8 (#11)

4.0.8 (#11) #58

Workflow file for this run

name: Create and publish a Docker image
# Configures this workflow to run every time a new tag is pushed on the main branch
on:
push:
tags:
- '[0-9]+.[0-9]+'
# Defines custom environment variables for the workflow
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ github.ref_name }}
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-22.04
strategy:
matrix:
version: ["v3.4.17", "v4.0.8"] # CHANGE THIS TO MATCH THE VERSIONS YOU WANT TO BUILD
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Set variables based on matrix version
- name: Set version variables
id: vars
run: |
LPP_VERSION="${{ matrix.version }}"
echo "LPP_VERSION=$LPP_VERSION" >> $GITHUB_OUTPUT
# Set image tags
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-$LPP_VERSION"
# Add latest tag for version 4
if [[ "$LPP_VERSION" == v4* ]]; then
TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
fi
echo "TAGS=$TAGS" >> $GITHUB_OUTPUT
# Build and push Docker image for each version
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.vars.outputs.TAGS }}
platforms: linux/amd64,linux/arm64
build-args: |
LPP_VERSION=${{ steps.vars.outputs.LPP_VERSION }}
LPP_CLIENT_CONTAINER_VERSION=${{ env.IMAGE_TAG }}
# Extract and upload artifacts for each version
- name: Pull AMD64 SDK Image
run: |
docker pull --platform=linux/amd64 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-${{ matrix.version }}
echo "ARTIFACT_IMAGE_TAG=${{ env.IMAGE_TAG }}-${{ matrix.version }}" >> $GITHUB_ENV
- name: Extract AMD64 Artifact
id: extract-amd64
run: |
docker run --platform=linux/amd64 --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.ARTIFACT_IMAGE_TAG }} cat /lpp-client.tar.gz > lpp-client-amd64-${{ matrix.version }}.tar.gz
- name: Upload AMD64 Artifact
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
files: ./lpp-client-amd64-${{ matrix.version }}.tar.gz
name: ${{ env.IMAGE_TAG }}
- name: Pull ARM64 SDK Image
run: |
docker pull --platform=linux/arm64 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.ARTIFACT_IMAGE_TAG }}
- name: Extract ARM64 Artifact
id: extract-arm64
run: |
docker run --platform=linux/arm64 --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.ARTIFACT_IMAGE_TAG }} cat /lpp-client.tar.gz > lpp-client-arm64-${{ matrix.version }}.tar.gz
- name: Upload ARM64 Artifact
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
files: ./lpp-client-arm64-${{ matrix.version }}.tar.gz
name: ${{ env.IMAGE_TAG }}