diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4b8bb0..7af8afe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,21 @@ jobs: echo Next version: $VERSION echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + - name: Make version info file + run: | + cat > cli-version.json << EOF + { + "CLI": "${{steps.next-ver.output.VERSION}}" + } + EOF + + - name: Upload version info + uses: actions/upload-artifact@v4 + with: + name: cli-version.json + path: ${{ github.workspace }}/cli-version.json + if-no-files-found: error + build: name: Build and test needs: semver diff --git a/.github/workflows/make_release.yml b/.github/workflows/make_release.yml new file mode 100644 index 0000000..44aabf5 --- /dev/null +++ b/.github/workflows/make_release.yml @@ -0,0 +1,49 @@ + +name: Release + +on: + + workflow_dispatch: + inputs: + target_branch: + description: 'Branch to run on' + required: true + default: 'main' +env: + LOCAL_ARTIFACTS: ${{ github.workspace }}/local_artifacts + +permissions: + contents: write + actions: read + +jobs: + + prepare: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Grab artifacts + uses: dawidd6/action-download-artifact@v11 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: ci.yml + workflow_conclusion: completed + branch: main + path: ${{ env.LOCAL_ARTIFACTS }} + + - name: Detect versions + id: get-tag + run: | + TAG=$(jq -r '.CLI' ${{ env.LOCAL_ARTIFACTS }}/cli-version.json) + echo "TAG=v$TAG" >> $GITHUB_OUTPUT + + - name: Create release + uses: ncipollo/release-action@v1 + with: + artifacts: "${{ env.LOCAL_ARTIFACTS }}/*.zip" + generateReleaseNotes: true + draft: true + name: ${{ steps.get-tag.outputs.TAG}} + tag: ${{ steps.get-tag.outputs.TAG}}