v0.14.0 #45
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
# GitHub Actions Workflow created for handling the release process based on the draft release prepared | |
# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided. | |
name: Release | |
on: | |
release: | |
types: [prereleased, released] | |
jobs: | |
buildRustLibrary: | |
name: Create Rust Library Artifact | |
runs-on: ubuntu-latest | |
container: | |
image: rust:alpine | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
- name: Setup dependencies | |
shell: sh | |
working-directory: ./jrad | |
run: | | |
apk update && apk add --no-cache git musl-dev xz asciidoctor zig | |
xz -d -c macos-sdk-11.3.tar.xz | tar -x | |
echo "SDKROOT=${{ github.workspace }}/jrad/macos-sdk-11.3" >> $GITHUB_ENV | |
- name: Install zig | |
shell: sh | |
working-directory: ./jrad | |
run: | | |
rustup target add \ | |
x86_64-unknown-linux-gnu \ | |
aarch64-unknown-linux-gnu \ | |
x86_64-apple-darwin \ | |
aarch64-apple-darwin | |
# cargo install cargo-zigbuild@0.19.3 | |
cargo install cargo-zigbuild | |
- name: Build library artifacts | |
shell: sh | |
working-directory: ./jrad | |
run: | | |
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 | |
# Prepare and publish the plugin to the Marketplace repository | |
release: | |
name: Publish Plugin | |
runs-on: ubuntu-latest | |
needs: buildRustLibrary | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
# Setup Java environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: corretto | |
java-version: 21 | |
- 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: Extract Changelog | |
id: changelog | |
shell: bash | |
run: | | |
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' | |
${{ github.event.release.body }} | |
EOM | |
)" | |
# remove empty lines, otherwise changelog plugin will lose rest of content | |
CHANGELOG="$(echo "$CHANGELOG" | grep -v '^$')" | |
if [[ "${CHANGELOG}" == "" ]]; then | |
echo "ERROR! Empty changelog! Aborting release!" | |
exit 1 | |
fi | |
echo 'changelog<<EOF' >> $GITHUB_OUTPUT | |
echo "${CHANGELOG}" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
# Update Unreleased section with the current release note | |
- name: Patch Changelog | |
if: ${{ steps.changelog.outputs.changelog != '' }} | |
env: | |
CHANGELOG: ${{ steps.changelog.outputs.changelog }} | |
run: | | |
echo "patching changelog with: $CHANGELOG" | |
./gradlew :patchChangelog --release-note="$CHANGELOG" | |
# Create pull request with changelog update | |
- name: Push changelog update | |
if: ${{ steps.changelog.outputs.changelog != '' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VERSION="${{ github.event.release.tag_name }}" | |
git config user.email "action@github.com" | |
git config user.name "GitHub Action" | |
git checkout -b main | |
git commit -am "Changelog update - $VERSION | |
Signed-off-by: github-actions <action@github.com> | |
" | |
git push --set-upstream origin main | |
- 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 | |
# Publish the plugin to the Marketplace | |
- name: Publish Plugin | |
env: | |
# PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | |
PUBLISH_TOKEN: ${{ secrets.CYTECH_PUBLISH_TOKEN }} | |
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} | |
run: | | |
./gradlew :publishPlugin | |
# Upload artifact as a release asset | |
- name: Upload Release Asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* --clobber | |
zip -r jrad.zip ./artifacts | |
gh release upload ${{ github.event.release.tag_name }} ./jrad.zip --clobber |