From 5db9f8ba747771709bbb555663bb6d3236bf45df Mon Sep 17 00:00:00 2001 From: jchrist Date: Wed, 15 Jan 2025 15:03:17 +0200 Subject: [PATCH] build: upload plugin and native libs to draft release as assets. --- .github/workflows/draft_release.yml | 37 ++++++++++++++++++++++------- .gitignore | 5 +++- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml index e7374a19..8bf10115 100644 --- a/.github/workflows/draft_release.yml +++ b/.github/workflows/draft_release.yml @@ -56,6 +56,7 @@ jobs: needs: buildRustLibrary outputs: version: ${{ steps.properties.outputs.version }} + filename: ${{ steps.artifact.outputs.filename }} steps: # Check out current repository - name: Fetch Sources @@ -115,17 +116,15 @@ jobs: # 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 - + FILENAME=$(ls *.zip) + #echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT + echo "filename=${FILENAME}" >> $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/*/* + path: ./build/distributions/${{ steps.artifact.outputs.filename }} # Prepare a draft release for GitHub Releases page for the manual verification # If accepted and published, release workflow would be triggered @@ -137,11 +136,9 @@ jobs: 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: @@ -150,7 +147,16 @@ jobs: gh api repos/{owner}/{repo}/releases \ --jq '.[] | select(.draft == true) | .id' \ | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} - + - name: Download native library + uses: actions/download-artifact@v4 + with: + name: jrad + path: ./artifacts + - name: Download built plugin + uses: actions/download-artifact@v4 + with: + name: ${{ needs.buildPluginArtifact.outputs.filename }} + path: ./${{ needs.buildPluginArtifact.outputs.filename }} # Create new release draft - which is not publicly visible and requires manual acceptance - name: Create Release Draft env: @@ -160,3 +166,16 @@ jobs: --draft \ --title "v${{ needs.buildPluginArtifact.outputs.version }}" \ --generate-notes + - name: Upload draft release assets + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PLUGIN_FILE: ${{ needs.buildPluginArtifact.outputs.filename }} + run: | + ls -al + # first identify draft release id. we cannot use just the draft release tag, + # as it may conflict with existing release + DRAFT_RELEASE_ID=$(gh api repos/{owner}/{repo}/releases --jq '.[] | select(.draft == true) | .id') + gh release upload "${DRAFT_RELEASE_ID}" "${PLUGIN_FILE}" --clobber + # zip up the native artifacts + zip -r jrad.zip ./artifacts + gh release upload "${DRAFT_RELEASE_ID}" jrad.zip --clobber diff --git a/.gitignore b/.gitignore index 4ccb2cc8..8d760b39 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,7 @@ video /out/ .intellijPlatform/ *.iml -target/ \ No newline at end of file +target/ +macos-sdk-11.3/ +META-INF/jrad/ +artifacts/ \ No newline at end of file