- Triggers on develop branch in addition to release/* branches - Develop pushes get tagged as :develop only - Release pushes continue to get :version, :release, and :latest tags
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'release/**'
|
|
- 'develop'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Compute image tags
|
|
id: meta
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
BRANCH=${GITHUB_REF#refs/heads/}
|
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
|
|
|
if [ "$BRANCH" = "develop" ]; then
|
|
echo "tags=reg.i3omb.com/sofarr:develop" >> $GITHUB_OUTPUT
|
|
echo "Building develop image (version ${VERSION})"
|
|
else
|
|
RELEASE_NAME=${BRANCH#release/}
|
|
TAGS="reg.i3omb.com/sofarr:${VERSION}"
|
|
TAGS="${TAGS},reg.i3omb.com/sofarr:${RELEASE_NAME}"
|
|
TAGS="${TAGS},reg.i3omb.com/sofarr:latest"
|
|
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
|
|
echo "Building release image ${VERSION} from branch ${BRANCH}"
|
|
fi
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: |
|
|
org.opencontainers.image.version=${{ steps.meta.outputs.version }}
|
|
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
|