Release push test #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Branch Workflow | |
| on: | |
| push: | |
| branches: | |
| - release/* | |
| jobs: | |
| build-jar: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'corretto' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Change wrapper permissions | |
| run: chmod +x ./gradlew | |
| - name: Build with Gradle Wrapper | |
| run: ./gradlew build | |
| - name: Extract project name from Gradle | |
| id: extract_name | |
| run: | | |
| PROJECT_NAME=$(./gradlew -q printProjectName) | |
| echo "PROJECT_NAME=${PROJECT_NAME}" >> $GITHUB_ENV | |
| - name: Extract version from Gradle | |
| id: get-version | |
| run: | | |
| VERSION=$(./gradlew -q printProjectVersion) | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| - name: Upload jars | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.ref_name }}-jars | |
| path: build/libs/*.jar | |
| build-and-push-docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version from file | |
| run: | | |
| VERSION=$(./gradlew -q printProjectVersion) | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Change wrapper permissions | |
| run: chmod +x ./gradlew | |
| - name: Build and push Docker image | |
| id: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }}, "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| push-to-registry: true | |
| package-and-push-helm: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| - name: Install Helm | |
| uses: azure/setup-helm@v4 | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Run chart-releaser | |
| uses: helm/chart-releaser-action@v1.6.0 | |
| with: | |
| charts_dir: helm | |
| packages_with_index: true | |
| env: | |
| CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Package Helm Chart | |
| run: | | |
| helm package ./helm --destination ./chart | |
| - name: Read Helm Chart | |
| id: helm-chart-reader | |
| uses: jacobtomlinson/gha-read-helm-chart@0.1.3 | |
| with: | |
| path: ./chart/* | |
| - name: Upload Helm Chart | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.ref_name }}-helm-chart | |
| path: build/libs/*.tgz | |
| create-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download jars | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ github.ref_name }}-jars | |
| path: artifacts/ | |
| - name: Download Helm Chart | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ github.ref_name }}-helm-chart | |
| path: artifacts/ | |
| - name: Extract version from file | |
| id: get-version | |
| run: | | |
| VERSION=$(./gradlew -q printProjectVersion) | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: true | |
| with: | |
| tag_name: ${{ env.VERSION }} | |
| body_path: ./CHANGELOG.md | |
| files: | | |
| artifacts/* | |
| dependency-submission: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'corretto' | |
| - name: Generate and submit dependency graph | |
| uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 |