diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6af01ea..8fc4ac0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ on: - 'README*' - 'LICENSE*' - 'shell.nix*' + release: + types: [published] jobs: build: @@ -39,73 +41,33 @@ jobs: timeout-minutes: 10 runs-on: ubuntu-latest needs: build - outputs: - pom_version: ${{ steps.read_version.outputs.pom_version }} - version_changed: ${{ steps.version_check.outputs.version_changed }} steps: - uses: actions/checkout@v4 with: 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 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 - if: github.event_name == 'push' && github.ref == 'refs/heads/master' + if: github.event_name == 'push' || github.event_name == 'release' uses: docker/login-action@v3 with: username: kruhlmann 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 with: context: . - push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - tags: ${{ steps.docker_tags.outputs.tags }} + push: true + tags: kruhlmann/imgfloat:latest - release: - timeout-minutes: 10 - runs-on: ubuntu-latest - needs: docker - if: github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.docker.outputs.version_changed == 'true' - steps: - - uses: actions/checkout@v4 + - name: Build & push release tag + if: github.event_name == 'release' + uses: docker/build-push-action@v5 with: - lfs: false - - - name: Create GitHub Release - 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 + context: . + push: true + tags: kruhlmann/imgfloat:${{ github.event.release.tag_name }} diff --git a/pom.xml b/pom.xml index 4b17d86..7a2e2fe 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ dev.kruhlmann imgfloat - 1.0.0 + 0.0.1 Imgfloat Livestream overlay with Twitch-authenticated channel admins and broadcasters. jar