Publish Draft Release #15
This file contains 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: Publish Draft Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version (e.g. 1.0.0)' | |
required: true | |
type: string | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build_test_linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
- name: Mark Gradle as Executable | |
run: chmod +x gradlew | |
- name: Build with Gradle Wrapper | |
run: ./gradlew build | |
- name: Publish to GitHub packages | |
run: ./gradlew publish | |
env: | |
MAVEN_DEPLOY_URL: "https://maven.pkg.github.com/${{github.repository}}" | |
MAVEN_DEPLOY_USERNAME: ${{ github.actor }} | |
MAVEN_DEPLOY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload CLI Jar | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jar-builds | |
path: build/libs/*.jar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-builds | |
path: build/libs/linux/ | |
build_windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
- name: Build with Gradle Wrapper | |
run: ./gradlew build -x test | |
- name: Sign exe with Trusted Signing | |
uses: azure/[email protected] | |
if: github.repository == 'HiveGamesOSS/Chunker' | |
with: | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} | |
endpoint: https://weu.codesigning.azure.net/ | |
trusted-signing-account-name: hivegames | |
certificate-profile-name: Chunker | |
files-folder: build/libs/windows/ | |
files-folder-filter: exe | |
file-digest: SHA256 | |
timestamp-rfc3161: http://timestamp.acs.microsoft.com | |
timestamp-digest: SHA256 | |
- name: Sign unpacked with Trusted Signing | |
uses: azure/[email protected] | |
if: github.repository == 'HiveGamesOSS/Chunker' | |
with: | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} | |
endpoint: https://weu.codesigning.azure.net/ | |
trusted-signing-account-name: hivegames | |
certificate-profile-name: Chunker | |
files-folder: build/libs/windows/win-unpacked/ | |
files-folder-filter: exe | |
file-digest: SHA256 | |
timestamp-rfc3161: http://timestamp.acs.microsoft.com | |
timestamp-digest: SHA256 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-builds | |
path: build/libs/windows/ | |
build_mac: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
- name: Mark Gradle as Executable | |
run: chmod +x gradlew | |
- name: Build with Gradle Wrapper | |
run: ./gradlew build -x test | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-builds | |
path: build/libs/mac/ | |
publish: | |
runs-on: ubuntu-latest | |
needs: [ build_test_linux, build_windows, build_mac ] | |
steps: | |
- name: Download JAR artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: jar-builds | |
path: artifacts | |
- name: Download Linux artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux-builds | |
path: artifacts | |
- name: Compress Linux CLI | |
run: | | |
cd artifacts && zip -r "chunker-cli-linux-amd64.zip" "chunker-cli" && cd .. | |
rm -rf "artifacts/chunker-cli" | |
- name: Compress Linux Unpacked | |
run: | | |
version="${{ github.event.inputs.version }}" | |
cd artifacts/linux-unpacked && zip -r "../Chunker-$version-amd64-linux.zip" . && cd ../.. | |
rm -rf "artifacts/linux-unpacked" | |
- name: Rename AppImage files | |
run: | | |
for file in artifacts/*.AppImage; do | |
mv "$file" "${file%.AppImage}-amd64-linux.AppImage" | |
done | |
- name: Rename deb files | |
run: | | |
for file in artifacts/*.deb; do | |
new_file="${file//chunker-electron_/Chunker-}" | |
new_file="${new_file//_/-}" | |
mv "$file" "${new_file%.deb}-linux.deb" | |
done | |
- name: Download Windows artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-builds | |
path: artifacts | |
- name: Compress Windows CLI | |
run: | | |
cd artifacts && zip -r "chunker-cli-windows-x86.zip" "chunker-cli" && cd .. | |
rm -rf "artifacts/chunker-cli" | |
- name: Compress Windows Unpacked | |
run: | | |
version="${{ github.event.inputs.version }}" | |
cd artifacts/win-unpacked && zip -r "../Chunker-$version-windows-x86.zip" . && cd ../.. | |
rm -rf "artifacts/win-unpacked" | |
- name: Rename exe files | |
run: | | |
for file in artifacts/*.exe; do | |
base_name="${file#artifacts/Chunker }" | |
base_name="${base_name%.exe}" | |
mv "$file" "artifacts/Chunker-${base_name}-windows-x86.exe" | |
done | |
- name: Download Mac artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos-builds | |
path: artifacts | |
- name: Compress Mac CLI | |
run: | | |
cd artifacts && zip -r "chunker-cli-mac-arm64.app.zip" "chunker-cli.app" && cd .. | |
rm -rf "artifacts/chunker-cli.app" | |
- name: Remove blockmap files | |
run: | | |
rm -rf artifacts/*.blockmap | |
- name: Rename dmg files | |
run: | | |
for file in artifacts/*.dmg; do | |
mv "$file" "${file%.dmg}-mac.dmg" | |
done | |
- name: Create Draft Release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GH_REPO: ${{ github.repository }} | |
run: | | |
tag="${{ github.event.inputs.version }}" | |
gh release create --draft "$tag" --title "$tag" --notes "TODO" | |
- name: Upload Artifacts | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GH_REPO: ${{ github.repository }} | |
run: | | |
for file in artifacts/*; do | |
gh release upload ${{ github.event.inputs.version }} "$file" | |
done |