Create Release Notes #23
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: Create Release Notes | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., 5.0.2)' | |
| required: true | |
| type: string | |
| default: '5.0.2' | |
| fromDate: | |
| description: 'From date for changelog (ISO format, e.g., 2025-08-19T16:30:00)' | |
| required: true | |
| type: string | |
| default: '2025-08-19T16:30:00' | |
| toDate: | |
| description: 'To date for changelog (ISO format, leave empty for current date)' | |
| required: false | |
| type: string | |
| milestone: | |
| description: 'Milestone version (e.g., 5.1)' | |
| required: true | |
| type: string | |
| default: '5.1' | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Generate changelog | |
| run: | | |
| GRADLE_ARGS="-Pversion=${{ inputs.version }} -Pmilestone=${{ inputs.milestone }} -PfromDate=${{ inputs.fromDate }}" | |
| if [ -n "${{ inputs.toDate }}" ]; then | |
| GRADLE_ARGS="$GRADLE_ARGS -PtoDate=${{ inputs.toDate }}" | |
| fi | |
| cd launch | |
| gradle buildChangelog $GRADLE_ARGS | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set artifact base URL | |
| id: artifact_url | |
| run: | | |
| if [[ "${{ inputs.version }}" == *".M"* ]] || [[ "${{ inputs.version }}" == *".RC"* ]]; then | |
| echo "base_url=https://openhab.jfrog.io/openhab/libs-milestone-local" >> $GITHUB_OUTPUT | |
| else | |
| echo "base_url=https://openhab.jfrog.io/artifactory/libs-release-local" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download openHAB distribution (ZIP) | |
| run: | | |
| curl -fLsS --retry 3 --retry-delay 5 \ | |
| -o openhab-${{ inputs.version }}.zip \ | |
| "${{ steps.artifact_url.outputs.base_url }}/org/openhab/distro/openhab/${{ inputs.version }}/openhab-${{ inputs.version }}.zip" | |
| - name: Download openHAB distribution (TAR.GZ) | |
| run: | | |
| curl -fLsS --retry 3 --retry-delay 5 \ | |
| -o openhab-${{ inputs.version }}.tar.gz \ | |
| "${{ steps.artifact_url.outputs.base_url }}/org/openhab/distro/openhab/${{ inputs.version }}/openhab-${{ inputs.version }}.tar.gz" | |
| - name: Download openHAB add-ons (KAR) | |
| run: | | |
| curl -fLsS --retry 3 --retry-delay 5 \ | |
| -o openhab-addons-${{ inputs.version }}.kar \ | |
| "${{ steps.artifact_url.outputs.base_url }}/org/openhab/distro/openhab-addons/${{ inputs.version }}/openhab-addons-${{ inputs.version }}.kar" | |
| - name: Create GitHub Release and upload assets | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Create or update release with notes from changelog and attach assets | |
| if gh release view "${{ inputs.version }}" >/dev/null 2>&1; then | |
| # Release exists: update notes and upload assets | |
| gh release edit "${{ inputs.version }}" \ | |
| --title "openHAB ${{ inputs.version }}" \ | |
| --notes-file "launch/build/changelog.md" | |
| else | |
| gh release create "${{ inputs.version }}" \ | |
| --title "openHAB ${{ inputs.version }}" \ | |
| --notes-file "launch/build/changelog.md" | |
| fi | |
| gh release upload "${{ inputs.version }}" \ | |
| "openhab-${{ inputs.version }}.zip" \ | |
| "openhab-${{ inputs.version }}.tar.gz" \ | |
| "openhab-addons-${{ inputs.version }}.kar" \ | |
| --clobber |