Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
required: true
type: string
description: "Docker tag, e.g. latest or 1.2.3"
push_latest:
required: false
type: boolean
default: true
description: "Whether to tag and push the image as latest"

jobs:
build-and-push:
Expand All @@ -23,8 +28,24 @@ jobs:
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: Lowercase repo name
id: repo
run: |
echo "names_lowercase=$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT

- name: Generate tags
id: tags
run: |
TAGS="ghcr.io/${{ steps.repo.outputs.names_lowercase }}/${{ inputs.image_name }}:${{ inputs.tag }}"
if [ "${{ inputs.push_latest }}" = "true" ]; then
TAGS="${TAGS}"$'\n'"ghcr.io/${{ steps.repo.outputs.names_lowercase }}/${{ inputs.image_name }}:latest"
fi
echo "docker_tags<<EOF" >> $GITHUB_OUTPUT
echo "$TAGS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -34,8 +55,6 @@ jobs:
with:
context: images/${{ inputs.image_name }}
push: true
tags: |
ghcr.io/${{ github.repository }}/${{ inputs.image_name }}:${{ inputs.tag }}
ghcr.io/${{ github.repository }}/${{ inputs.image_name }}:latest
tags: "${{ steps.tags.outputs.docker_tags }}"
cache-from: type=gha
cache-to: type=gha,mode=max
29 changes: 24 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:
description: "Tag to push (e.g. 1.2.3)"
required: true
type: string
push_latest:
description: "Tag and push as latest"
required: true
type: boolean
default: true

permissions:
contents: read
Expand All @@ -25,27 +30,41 @@ jobs:
parse-tag:
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.parse.outputs.image_name }}
tag: ${{ steps.parse.outputs.tag }}
image_name: "${{ steps.parse.outputs.image_name }}"
tag: "${{ steps.parse.outputs.tag }}"
push_latest: "${{ steps.parse.outputs.push_latest }}"
steps:
- name: Parse tag or inputs
- name: Checkout repo
uses: actions/checkout@v4

- name: Parse tag or inputs and validate
id: parse
run: |
if [ "${{ github.event_name }}" = "push" ]; then
REF="${{ github.ref_name }}" # e.g. bpy/v1.2.3
IMAGE="${REF%%/*}" # bpy
TAG="${REF##*/v}" # 1.2.3
PUSH_LATEST="true"
else
IMAGE="${{ inputs.image_name }}"
TAG="${{ inputs.tag }}"
PUSH_LATEST="${{ inputs.push_latest }}"
fi

if [ ! -f "images/$IMAGE/Dockerfile" ]; then
echo "::error::Dockerfile not found at images/$IMAGE/Dockerfile. Please check your image name."
exit 1
fi

echo "image_name=$IMAGE" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "push_latest=$PUSH_LATEST" >> $GITHUB_OUTPUT

build:
needs: parse-tag
uses: ./.github/workflows/build-image.yml
secrets: inherit
with:
image_name: ${{ needs.parse-tag.outputs.image_name }}
tag: ${{ needs.parse-tag.outputs.tag }}
image_name: "${{ needs.parse-tag.outputs.image_name }}"
tag: "${{ needs.parse-tag.outputs.tag }}"
push_latest: "${{ needs.parse-tag.outputs.push_latest == 'true' }}"
2 changes: 1 addition & 1 deletion images/bpy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/catthehacker/ubuntu:act-latest
FROM ghcr.io/catthehacker/ubuntu:act-22.04

ENV DEBIAN_FRONTEND=noninteractive

Expand Down