Make build pipeline work for us
All checks were successful
Build and push GARM images to EDP / Build GARM images (push) Successful in 1h25m51s
All checks were successful
Build and push GARM images to EDP / Build GARM images (push) Successful in 1h25m51s
This commit is contained in:
parent
8f1cd9f974
commit
1da4df0a3c
1 changed files with 27 additions and 25 deletions
52
.github/workflows/build-and-push.yml
vendored
52
.github/workflows/build-and-push.yml
vendored
|
|
@ -1,5 +1,10 @@
|
|||
name: "Build and push GARM images"
|
||||
name: "Build and push GARM images to EDP"
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- feat/forgejo
|
||||
workflow_dispatch: {}
|
||||
workflow_call:
|
||||
inputs:
|
||||
push_to_project:
|
||||
|
|
@ -11,54 +16,51 @@ on:
|
|||
description: "Ref to build"
|
||||
required: false
|
||||
type: string
|
||||
default: "main"
|
||||
default: "feat/forgejo"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
images:
|
||||
permissions:
|
||||
packages: write
|
||||
|
||||
name: "Build GARM images"
|
||||
runs-on: ubuntu-noble-garm
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
path: src/github.com/cloudbase/garm
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker
|
||||
uses: docker/setup-docker-action@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Docker login
|
||||
run: |
|
||||
REGISTRY="${GITHUB_SERVER_URL#https://}"
|
||||
echo "${{ secrets.PACKAGES_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.repository_owner }}" --password-stdin
|
||||
echo "DOCKER_REGISTRY=$REGISTRY" >> "$GITHUB_ENV"
|
||||
echo "DOCKER_ORG=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build and push image
|
||||
env:
|
||||
IMAGE_REGISTRY: ${{ inputs.push_to_project }}
|
||||
GH_REF: ${{ inputs.ref }}
|
||||
working-directory: src/github.com/cloudbase/garm
|
||||
run: |
|
||||
if [ "$GH_REF" == "main" ]; then
|
||||
IMAGE_REPO=$(echo "${GITHUB_SERVER_URL#https://}/${FORGEJO_REPOSITORY}" | tr "[:upper:]" "[:lower:]")
|
||||
if [ "$FORGEJO_REF_NAME" == "main" ]; then
|
||||
IMAGE_TAG="nightly"
|
||||
elif [ "$FORGEJO_REF_NAME" == "feat/forgejo" ]; then
|
||||
IMAGE_TAG="forgejo"
|
||||
else
|
||||
IMAGE_TAG=$(git describe --tags --match='v[0-9]*' --always ${GH_REF})
|
||||
IMAGE_TAG=$(git describe --tags --match='v[0-9]*' --always ${FORGEJO_REF_NAME})
|
||||
fi
|
||||
echo "Pushing to $IMAGE_REPO:$IMAGE_TAG"
|
||||
docker buildx build \
|
||||
--provenance=false \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--label "org.opencontainers.image.source=https://github.com/cloudbase/garm/tree/${GH_REF}" \
|
||||
--label "org.opencontainers.image.description=GARM ${GH_REF}" \
|
||||
--label "org.opencontainers.image.source=https://github.com/cloudbase/garm/tree/${FORGEJO_REF_NAME}" \
|
||||
--label "org.opencontainers.image.description=GARM ${FORGEJO_REF_NAME}" \
|
||||
--label "org.opencontainers.image.licenses=Apache 2.0" \
|
||||
--build-arg="GARM_REF=${GH_REF}" \
|
||||
-t ${IMAGE_REGISTRY}/garm:"${IMAGE_TAG}" \
|
||||
--build-arg="GARM_REF=${FORGEJO_REF_NAME}" \
|
||||
-t ${IMAGE_REPO}:"${IMAGE_TAG}" \
|
||||
--push .
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue