This commit is contained in:
2026-01-26 18:20:46 +01:00
parent ebdd9e9f18
commit 9cf25a4351
2 changed files with 14 additions and 52 deletions

View File

@@ -15,6 +15,8 @@ on:
- 'README*' - 'README*'
- 'LICENSE*' - 'LICENSE*'
- 'shell.nix*' - 'shell.nix*'
release:
types: [published]
jobs: jobs:
build: build:
@@ -39,73 +41,33 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
outputs:
pom_version: ${{ steps.read_version.outputs.pom_version }}
version_changed: ${{ steps.version_check.outputs.version_changed }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true lfs: true
- name: Check for pom.xml changes
id: version_check
run: |
if [ "${{ github.event_name }}" != "push" ]; then
echo "version_changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- pom.xml | grep -q '^pom.xml$'; then
echo "version_changed=true" >> "$GITHUB_OUTPUT"
else
echo "version_changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Read pom.xml version
id: read_version
run: |
VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
echo "pom_version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Set Docker tags
id: docker_tags
run: |
TAGS="kruhlmann/imgfloat-j:latest,kruhlmann/imgfloat-j:${{ github.sha }}"
if [ "${{ steps.version_check.outputs.version_changed }}" = "true" ]; then
TAGS="$TAGS,kruhlmann/imgfloat-j:${{ steps.read_version.outputs.pom_version }}"
fi
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
- name: Log in to Docker Hub - name: Log in to Docker Hub
if: github.event_name == 'push' && github.ref == 'refs/heads/master' if: github.event_name == 'push' || github.event_name == 'release'
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: kruhlmann username: kruhlmann
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image - name: Build & push latest
if: github.event_name == 'push'
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} push: true
tags: ${{ steps.docker_tags.outputs.tags }} tags: kruhlmann/imgfloat:latest
release: - name: Build & push release tag
timeout-minutes: 10 if: github.event_name == 'release'
runs-on: ubuntu-latest uses: docker/build-push-action@v5
needs: docker
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.docker.outputs.version_changed == 'true'
steps:
- uses: actions/checkout@v4
with: with:
lfs: false context: .
push: true
- name: Create GitHub Release tags: kruhlmann/imgfloat:${{ github.event.release.tag_name }}
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.docker.outputs.pom_version }}
name: v${{ needs.docker.outputs.pom_version }}
generate_release_notes: true

View File

@@ -5,7 +5,7 @@
<groupId>dev.kruhlmann</groupId> <groupId>dev.kruhlmann</groupId>
<artifactId>imgfloat</artifactId> <artifactId>imgfloat</artifactId>
<version>1.0.0</version> <version>0.0.1</version>
<name>Imgfloat</name> <name>Imgfloat</name>
<description>Livestream overlay with Twitch-authenticated channel admins and broadcasters.</description> <description>Livestream overlay with Twitch-authenticated channel admins and broadcasters.</description>
<packaging>jar</packaging> <packaging>jar</packaging>