From b36fb43d7398aad5a03256ae91cf8ee93ab37816 Mon Sep 17 00:00:00 2001 From: grimsi <9295182+grimsi@users.noreply.github.com> Date: Tue, 15 Jul 2025 20:19:25 +0200 Subject: [PATCH] Add Plugin-API release step to Release workflow --- .github/workflows/pluginapi-release.yml | 35 ------------ .github/workflows/release.yml | 74 +++++++++++++++++++------ 2 files changed, 58 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/pluginapi-release.yml diff --git a/.github/workflows/pluginapi-release.yml b/.github/workflows/pluginapi-release.yml deleted file mode 100644 index 5d45f2e..0000000 --- a/.github/workflows/pluginapi-release.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Plugin-API Release - -on: - push: - tags: - - '*' - -jobs: - release: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - cache: gradle - - - name: Decrypt and import GPG key - run: | - echo "$GPG_PRIVATE_KEY" | gpg --batch --import - env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - - - name: Build and deploy with JReleaser - run: ./gradlew jreleaserFullRelease - env: - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} - MAVENCENTRAL_TOKEN: ${{ secrets.MAVENCENTRAL_TOKEN }} - JRELEASER_GITHUB_TOKEN: ${{ GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4de206..563ad18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,58 +13,68 @@ on: type: boolean jobs: - release: + setup: runs-on: ubuntu-latest permissions: contents: write env: RELEASE_VERSION: ${{ github.event.inputs.version }} + outputs: + release_version: ${{ steps.get_version.outputs.release_version }} steps: - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 0 # Needed for git tag - + fetch-depth: 0 - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - - name: Get version from build.gradle.kts if not provided id: get_version run: | if [ -z "${{ github.event.inputs.version }}" ]; then VERSION=$(grep '^version = ' build.gradle.kts | sed 's/version = "\(.*\)"/\1/') + echo "release_version=$VERSION" >> $GITHUB_OUTPUT echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV else + echo "release_version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV fi - - name: Update version in build.gradle.kts if: ${{ github.event.inputs.update_version }} run: | sed -i "s/^version = .*/version = \"$RELEASE_VERSION\"/" build.gradle.kts - - name: Update version in app/package.json if: ${{ github.event.inputs.update_version }} run: | jq ".version = \"$RELEASE_VERSION\"" app/package.json > app/package.json.tmp && mv app/package.json.tmp app/package.json + docker: + needs: setup + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' - name: Run production build env: GAMEYFIN_KEYSTORE_PASSWORD: ${{ secrets.GAMEYFIN_KEYSTORE_PASSWORD }} run: ./gradlew clean build -Pvaadin.productionMode=true - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Docker image uses: docker/build-push-action@v5 with: @@ -72,30 +82,62 @@ jobs: file: docker/Dockerfile platforms: linux/arm64/v8,linux/amd64 push: true - tags: grimsi/gameyfin:${{ env.RELEASE_VERSION }} + tags: grimsi/gameyfin:${{ needs.setup.outputs.release_version }} + plugin_api: + needs: setup + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - name: Decrypt and import GPG key + run: | + echo "$GPG_PRIVATE_KEY" | gpg --batch --import + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + - name: Build and push Plugin-API + run: ./gradlew jreleaserFullRelease + env: + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} + MAVENCENTRAL_TOKEN: ${{ secrets.MAVENCENTRAL_TOKEN }} + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + finalize: + needs: [ docker, plugin_api ] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Commit version bump if: ${{ github.event.inputs.update_version }} uses: stefanzweifel/git-auto-commit-action@v6 with: - commit_message: 'chore: release v${{ env.RELEASE_VERSION }}' - tagging_message: v${{ env.RELEASE_VERSION }} - + commit_message: 'chore: release v${{ needs.setup.outputs.release_version }}' + tagging_message: v${{ needs.setup.outputs.release_version }} - name: Detect prerelease id: detect_prerelease run: | - if [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "${{ needs.setup.outputs.release_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "IS_PRERELEASE=false" >> $GITHUB_ENV echo "MAKE_LATEST=true" >> $GITHUB_ENV else echo "IS_PRERELEASE=true" >> $GITHUB_ENV echo "MAKE_LATEST=false" >> $GITHUB_ENV fi - - name: Create GitHub release if: ${{ github.event.inputs.update_version }} uses: softprops/action-gh-release@v2 with: - tag_name: v${{ env.RELEASE_VERSION }} + tag_name: v${{ needs.setup.outputs.release_version }} prerelease: ${{ env.IS_PRERELEASE }} make_latest: ${{ env.MAKE_LATEST }}