Skip to content

Fix build steps

Fix build steps #98

Workflow file for this run

name: buildx
on:
workflow_dispatch:
pull_request:
schedule:
- cron: '22 4 * * 0'
push:
branches:
- 'master'
env:
PLATFORMS: linux/amd64 #,linux/arm64
jobs:
buildx:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
- name: Set up Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
- name: Set up variable repository name
run: echo "IMAGE_NAME=${{ github.repository }}" >> $GITHUB_ENV
- name: Login to ghcr.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Initial Buildx
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
with:
context: .
file: Containerfile
tags: ${{ env.IMAGE_NAME }}:testing
platforms: ${{ env.PLATFORMS }}
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Load Built Image and Get Variables
id: vars
run: |
# docker buildx build \
# -f Containerfile \
# -t ${{ env.IMAGE_NAME }}:testing \
# --platform=linux/amd64 \
# --cache-to type=gha,mode=max \
# --cache-from type=gha \
# --load \
# .
# CID=$(docker run -d ghcr.io/${{ env.IMAGE_NAME }}:testing)
# VER_FULL=$(docker exec $CID rpm -q --queryformat '%{VERSION}' zpa-connector)
docker run --rm ghcr.io/${{ env.IMAGE_NAME }}:testing rpm -q --queryformat '%{VERSION}' zpa-connector
# echo "VER_FULL=$VER_FULL" >> $GITHUB_ENV
# # docker rm -f $CID
# VER_MINOR=$(echo $VER_FULL | cut -d. -f-2)
# echo "VER_MINOR=$VER_MINOR" >> $GITHUB_ENV
# VER_MAJOR=$(echo $VER_FULL | cut -d. -f-1)
# echo "VER_MAJOR=$VER_MAJOR" >> $GITHUB_ENV
# - name: Buildx and Push
# uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
# with:
# context: .
# file: Containerfile
# tags: |
# ghcr.io/${{ env.IMAGE_NAME }}:latest
# ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_FULL }}
# ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }}
# ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }}
# platforms: ${{ env.PLATFORMS }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# push: true
# provenance: false