Skip to content

feature: Java 21 LTS #61

feature: Java 21 LTS

feature: Java 21 LTS #61

Workflow file for this run

name: "Build Release"
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
linux_release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_ntag_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build Linux Version with Gradle
id: build-linux
run: ./gradlew jre build -Pplatform=linux -Ptests=Unit
- name: Get NTag version
id: get_ntag_version
run: |
VERSION=$(./gradlew version -q)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Create SHA256 Checksum
run: sha256sum ./build/distributions/ntag-${{ env.VERSION }}-linux_bin.tar.gz > ./build/distributions/ntag-${{ env.VERSION }}-linux_bin_sha256.txt
- name: Upload Linux Release Asset
id: upload-linux-release-asset
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ./build/distributions/ntag-${{ env.VERSION }}-linux_bin.tar.gz
name: ntag-${{ env.VERSION }}-linux_bin.tar.gz
retention-days: 7
- name: Upload Linux Checksum SHA256 Asset
id: upload-linux-checksum-asset
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ./build/distributions/ntag-${{ env.VERSION }}-linux_bin_sha256.txt
name: ntag-${{ env.VERSION }}-linux_bin_sha256.txt
retention-days: 7
windows_release:
needs: linux_release
runs-on: windows-latest
env:
VERSION: ${{ needs.linux_release.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build Windows Version with Gradle
id: build-windows
run: ./gradlew jre build -x test -Pplatform=win
- name: Create NSIS Installer
run: |
7z x -obuild/distributions ./build/distributions/ntag-${{ env.VERSION }}-win_bin.zip
(Get-Content -Path ntag.nsi) -replace 'XXX', '${{ env.VERSION }}' | Add-Content -Path ./build/distributions/ntag-${{ env.VERSION }}/ntag.nsi
cd ./build/distributions/ntag-${{ env.VERSION }}
makensis ntag.nsi
- name: Create SHA256 Checksums
id: checksums
run: |
Get-Filehash ./build/distributions/ntag-${{ env.VERSION }}-win_bin.zip -Algorithm SHA256 | Format-List -Property Hash > ./build/distributions/ntag-${{ env.VERSION }}-win_bin_sha256.txt
Get-Filehash ./build/distributions/ntag-${{ env.VERSION }}/NTag-${{ env.VERSION }}-win-setup.exe -Algorithm SHA256 | Format-List -Property Hash > ./build/distributions/ntag-${{ env.VERSION }}-win_setup_sha256.txt
- name: Upload Windows ZIP Release Asset
id: upload-win-release-asset
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ./build/distributions/ntag-${{ env.VERSION }}-win_bin.zip
name: ntag-${{ env.VERSION }}-win_bin.zip
retention-days: 7
- name: Upload Windows ZIP SHA256 Asset
id: upload-win-bin-sha256-asset
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ./build/distributions/ntag-${{ env.VERSION }}-win_bin_sha256.txt
name: ntag-${{ env.VERSION }}-win_bin_sha256.txt
retention-days: 7
- name: Upload Windows Installer Asset
id: upload-win-installer-asset
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ./build/distributions/ntag-${{ env.VERSION }}/NTag-${{ env.VERSION }}-win-setup.exe
name: ntag-${{ env.VERSION }}-win-setup.exe
retention-days: 7
- name: Upload Windows Installer SHA256 Asset
id: upload-win-installer-sha256-asset
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ./build/distributions/ntag-${{ env.VERSION }}-win_setup_sha256.txt
name: ntag-${{ env.VERSION }}-win_setup_sha256.txt
retention-days: 7
create_release:
runs-on: ubuntu-latest
needs:
- linux_release
- windows_release
env:
VERSION: ${{ needs.linux_release.outputs.version }}
steps:
- name: Download all artifcats
uses: actions/download-artifact@v3
- name: fix-windows-setup
run: mv /home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-win-setup.exe/NTag-${{ env.VERSION }}-win-setup.exe /home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-win-setup.exe/ntag-${{ env.VERSION }}-win-setup.exe
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
draft: true
prerelease: false
generate_release_notes: false
files: |
/home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-linux_bin_sha256.txt/ntag-${{ env.VERSION }}-linux_bin_sha256.txt
/home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-linux_bin.tar.gz/ntag-${{ env.VERSION }}-linux_bin.tar.gz
/home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-win_setup_sha256.txt/ntag-${{ env.VERSION }}-win_setup_sha256.txt
/home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-win-setup.exe/ntag-${{ env.VERSION }}-win-setup.exe
/home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-win_bin_sha256.txt/ntag-${{ env.VERSION }}-win_bin_sha256.txt
/home/runner/work/ntag/ntag/ntag-${{ env.VERSION }}-win_bin.zip/ntag-${{ env.VERSION }}-win_bin.zip