From 12ac7edbc50564d4f932784f2f7a8e07c4f6f6b4 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 25 May 2025 18:08:18 -0600 Subject: [PATCH] Add workflow to build the release --- github/workflows/draft-release.yaml | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 github/workflows/draft-release.yaml diff --git a/github/workflows/draft-release.yaml b/github/workflows/draft-release.yaml new file mode 100644 index 0000000..b3f9b77 --- /dev/null +++ b/github/workflows/draft-release.yaml @@ -0,0 +1,51 @@ +name: Create Draft Release +on: [workflow_dispatch] +jobs: + everything: + runs-on: ubuntu-latest + steps: + # Checkout the repository + - uses: actions/checkout@v4 + + # Install node and NPM + - uses: actions/setup-node@v4 + with: + node-version: "19" + + # Install required packages + - run: npm install + - run: npm run build + + - name: Reading the system.json for the version + id: "version" + run: cat prod.dist/system.json | echo version=`jq -r ".version"` >> "$GITHUB_OUTPUT" + + # Check that tag doesn't exist + - uses: mukunku/tag-exists-action@v1.5.0 + id: check-tag + with: + tag: "v${{ steps.version.outputs.version }}" + + - name: "Ensure that the tag doesn't exist" + if: ${{ steps.check-tag.outputs.exists == 'true' }} + run: exit 1 + + - name: Move the manifest to a temp file + id: manifest-move + run: mv prod.dist/module.json prod.dist/module.temp.json + + - name: Update the download property in the manifest + id: manifest-update + run: cat prod.dist/module.temp.json | jq -r --tab '.download = "https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.version }}/release.zip"' > prod.dist/module.json + + - name: Create the zip + run: zip -r release.zip prod.dist/* + + - name: Create the draft release + uses: ncipollo/release-action@v1 + with: + tag: "v${{ steps.version.outputs.version }}" + commit: ${{ github.ref }} + draft: true + generateReleaseNotes: true + artifacts: "release.zip,prod.dist/module.json" \ No newline at end of file