Draft Release #317
Workflow file for this run
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: Draft Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
jobs: | |
buildRustLibrary: | |
name: Create Rust Library Artifact | |
runs-on: ubuntu-latest | |
container: | |
#image: rust:1.81-alpine3.20 | |
image: rust:alpine | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
- name: Install and Build | |
shell: sh | |
env: | |
SDKROOT: ${{ github.workspace }}/jrad/macos-sdk-11.3 | |
run: | | |
cd ./jrad | |
apk update && apk add --no-cache git musl-dev xz asciidoctor zig | |
xz -d -c macos-sdk-11.3.tar.xz | tar -x | |
rustup target add \ | |
x86_64-unknown-linux-gnu \ | |
aarch64-unknown-linux-gnu \ | |
x86_64-apple-darwin \ | |
aarch64-apple-darwin | |
# cargo install [email protected] | |
cargo install cargo-zigbuild | |
cargo zigbuild --locked --release \ | |
--target=x86_64-apple-darwin \ | |
--target=aarch64-apple-darwin \ | |
--target=x86_64-unknown-linux-gnu \ | |
--target=aarch64-unknown-linux-gnu | |
- name: Gather artifacts for upload | |
shell: sh | |
run: | | |
mkdir -p ./artifacts | |
cp ./jrad/target/aarch64-unknown-linux-gnu/release/libjrad.so ./artifacts/aarch64_libjrad.so | |
cp ./jrad/target/aarch64-unknown-linux-gnu/release/jrad ./artifacts/aarch64_jrad | |
cp ./jrad/target/aarch64-apple-darwin/release/libjrad.dylib ./artifacts/aarch64_libjrad.dylib | |
cp ./jrad/target/x86_64-apple-darwin/release/libjrad.dylib ./artifacts/x86_64_libjrad.dylib | |
cp ./jrad/target/x86_64-unknown-linux-gnu/release/libjrad.so ./artifacts/x86_64_libjrad.so | |
cp ./jrad/target/x86_64-unknown-linux-gnu/release/jrad ./artifacts/x86_64_jrad | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jrad | |
path: artifacts | |
buildPluginArtifact: | |
name: Create Plugin Artifact | |
runs-on: ubuntu-latest | |
needs: buildRustLibrary | |
outputs: | |
version: ${{ steps.properties.outputs.version }} | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Validate wrapper | |
- name: Gradle Wrapper Validation | |
uses: gradle/actions/wrapper-validation@v4 | |
# Setup Java environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: corretto | |
java-version: 21 | |
cache: gradle | |
# Set environment variables | |
- name: Export Properties | |
id: properties | |
shell: bash | |
run: | | |
PROPERTIES="$(./gradlew properties --console=plain -q)" | |
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | |
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "name=$NAME" >> $GITHUB_OUTPUT | |
- name: Install Radicle | |
env: | |
RAD_HOME: ${{ github.workspace }}/.radicle | |
run: | | |
curl -sSf https://radicle.xyz/install | sh | |
echo "${RAD_HOME}/bin" >> $GITHUB_PATH | |
echo "RAD_HOME=${{ github.workspace }}/.radicle" >> $GITHUB_ENV | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: jrad | |
path: ./artifacts | |
- name: Copy jrad libraries/binaries | |
run: | | |
mkdir -p ./src/main/resources/META-INF/jrad/aarch64 | |
mkdir -p ./src/main/resources/META-INF/jrad/x86_64 | |
cp ./artifacts/aarch64_libjrad.so ./src/main/resources/META-INF/jrad/aarch64/libjrad.so | |
cp ./artifacts/aarch64_jrad ./src/main/resources/META-INF/jrad/aarch64/jrad | |
cp ./artifacts/aarch64_libjrad.dylib ./src/main/resources/META-INF/jrad/aarch64/libjrad.dylib | |
cp ./artifacts/x86_64_libjrad.dylib ./src/main/resources/META-INF/jrad/x86_64/libjrad.dylib | |
cp ./artifacts/x86_64_libjrad.so ./src/main/resources/META-INF/jrad/x86_64/libjrad.so | |
cp ./artifacts/x86_64_jrad ./src/main/resources/META-INF/jrad/x86_64/jrad | |
ls -R ./src/main/resources/META-INF | |
# Prepare plugin archive content for creating artifact | |
- name: Prepare Plugin Artifact | |
id: artifact | |
shell: bash | |
run: | | |
# on linux there's a bug that causes buildPlugin to fail the first time: https://youtrack.jetbrains.com/issue/IDEA-291977 | |
./gradlew buildPlugin || ./gradlew buildPlugin | |
cd ${{ github.workspace }}/build/distributions | |
FILENAME=`ls *.zip` | |
unzip "$FILENAME" -d content | |
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT | |
# Store already-built plugin as an artifact for downloading | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.artifact.outputs.filename }} | |
path: ./build/distributions/content/*/* | |
# Prepare a draft release for GitHub Releases page for the manual verification | |
# If accepted and published, release workflow would be triggered | |
releaseDraft: | |
name: Release Draft | |
if: github.event_name != 'pull_request' | |
needs: buildPluginArtifact | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Remove old release drafts by using the curl request for the available releases with draft flag | |
- name: Remove Old Release Drafts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api repos/{owner}/{repo}/releases \ | |
--jq '.[] | select(.draft == true) | .id' \ | |
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} | |
# Create new release draft - which is not publicly visible and requires manual acceptance | |
- name: Create Release Draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create v${{ needs.buildPluginArtifact.outputs.version }} \ | |
--draft \ | |
--title "v${{ needs.buildPluginArtifact.outputs.version }}" \ | |
--generate-notes |