When tags matching the pattern 'v[0-9]+' are pushed a new image is built and published. It is tagged with the number and in addition "latest".
53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: Publish container to package registry
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+'
|
|
|
|
jobs:
|
|
build-test-publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 25
|
|
cache: maven
|
|
|
|
- name: Build with Maven
|
|
run: ./mvnw verify --batch-mode --no-transfer-progress --fail-fast
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ gitea.server_url }}
|
|
username: ${{ secrets.PACKAGES_USERNAME }}
|
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
|
|
|
- name: Extract version (remove leading v)
|
|
id: vars
|
|
run: |
|
|
TAG=${GITEA_REF_NAME}
|
|
VERSION=${TAG#v}
|
|
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: false
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: |
|
|
${{ gitea.server_url }}/${{ gitea.repository_owner }}/oauth2:${{ steps.vars.outputs.VERSION }}
|
|
${{ gitea.server_url }}/${{ gitea.repository_owner }}/oauth2:latest
|