mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
New CI
This commit is contained in:
64
.github/workflows/ci.yml
vendored
64
.github/workflows/ci.yml
vendored
@@ -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 }}
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>dev.kruhlmann</groupId>
|
||||
<artifactId>imgfloat</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>0.0.1</version>
|
||||
<name>Imgfloat</name>
|
||||
<description>Livestream overlay with Twitch-authenticated channel admins and broadcasters.</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
Reference in New Issue
Block a user