Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: DWH Dumper Create Release

# Trigger the workflow when a new tag is pushed (e.g., v1.2.3)
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:

jobs:
build-and-release:
name: Build and Release
runs-on: ubuntu-latest
# Grant permissions for the GITHUB_TOKEN to create releases
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'

# This step replaces the initial if/else block in the script
- name: Determine Artifact Details
id: artifact_details
run: |
echo "RELEASE_ARTIFACT_DIR=dumper/app/build/distributions" >> $GITHUB_ENV
echo "ARTIFACT_NAME=dwh-migration-dumper" >> $GITHUB_ENV

- name: Run tests with Gradle
run: ./gradlew -Pci :dumper:app:test

- name: Build final artifact with Gradle
run: ./gradlew -Pci :dumper:app:publishedDistZip -Pversion="${{ github.ref_name }}"

- name: Calculate artifact checksum
run: |
cd ${{ env.RELEASE_ARTIFACT_DIR }}
sha256sum "${{ env.ARTIFACT_NAME }}-${{ github.ref_name }}.zip" > SHA256SUMS.txt

# This single action replaces all the curl/jq/git commands for publishing
- name: Create GitHub Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
# Automatically generate release notes from commits since the last tag
generate_release_notes: true
# The files to upload as release assets
files: |
${{ env.RELEASE_ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}-${{ github.ref_name }}.zip
${{ env.RELEASE_ARTIFACT_DIR }}/SHA256SUMS.txt
Loading