From 6c316cf9ffc7e798ff8b6c1ed64c4dd19be20322 Mon Sep 17 00:00:00 2001 From: rindeal Date: Sun, 17 Mar 2024 16:23:02 +0000 Subject: [PATCH] >>>> --- .github/workflows/release.yml | 24 +++++++++++++++--------- Makefile | 5 +++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index af7697f..5b3e9e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,12 +18,10 @@ jobs: - name: Create draft release env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" } run: > - gh release create "${{ github.ref_name }}" + gh release create "${{ github.sha }}" --title "amalgamate ${{ github.ref_name }}" - --notes "$(printf "foo\n**bar**\n")" --draft --generate-notes - --verify-tag source: needs: [ draft ] @@ -40,7 +38,7 @@ jobs: - name: Upload assets env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" } - run: gh release upload --clobber "${{ github.ref_name }}" ${archives} + run: gh release upload --clobber "${{ github.sha }}" ${archives} linux_macos: needs: [ draft ] @@ -55,7 +53,7 @@ jobs: - name: Create and upload assets env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" } - run: make GH_TAG="${{ github.ref_name }}" gh-upload + run: make gh-upload REL_VER="${{ github.ref_name }}" GH_TAG="${{ github.sha }}" windows: needs: [ draft ] @@ -76,12 +74,20 @@ jobs: - name: Upload assets env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" } - run: gh release upload --clobber "${{ github.ref_name }}" "${env:archive}" + run: gh release upload --clobber "${{ github.sha }}" "${env:archive}" finish: needs: [ linux_macos, windows, source ] runs-on: ubuntu-latest + env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" } steps: - - name: Finish release - env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" } - run: gh release edit --draft=false --repo=${{ github.repository }} "${{ github.ref_name }}" + - run: | + set -e + gh release view --json body --jq .body "${{ github.sha }}" > autogen-notes.md + sed -i -e "s|${{ github.sha }}|${{ github.ref_name }}|g" -- autogen-notes.md + echo "#Foo" >> notes.md + echo >> notes.md + echo "**bar** _baz_" >> notes.md + echo >> notes.md + cat autogen-notes.md >> notes.md + gh release edit --draft=false --notes-file notes.md --repo=${{ github.repository }} "${{ github.sha }}" diff --git a/Makefile b/Makefile index 717676b..b8f40f3 100644 --- a/Makefile +++ b/Makefile @@ -87,14 +87,15 @@ git-tag: _git-tag-set-check git-tag-delete gh-upload: $(PROGRAM) @test -n "$(GH_TAG)" || (echo "Error: Variable 'GH_TAG' not set" >&2; exit 1) + @test -n "$(REL_VER)" || (echo "Error: Variable 'REL_VER' not set" >&2; exit 1) set -ex ;\ platform="$$(uname -s | tr '[:upper:]' '[:lower:]')" ;\ arch="$$(uname -m | tr '[:upper:]' '[:lower:]' | sed 's|x86_64|amd64|')" ;\ - archive_basename="$(PROGRAM)-$(GH_TAG)-$${platform}-$${arch}" ;\ + archive_basename="$(PROGRAM)-$(REL_VER)-$${platform}-$${arch}" ;\ $(MKDIR) -v "$${archive_basename}" ;\ $(CP) -v -a $(GH_ASSETS) "$${archive_basename}" ;\ $(ZIP) -r "$${archive_basename}.zip" "$${archive_basename}" ;\ - $(GH) release upload --clobber "$(GH_TAG)" "$${archive_basename}.zip" ;\ + $(GH) release upload --clobber "$(GH_SHA)" "$${archive_basename}.zip" ;\ set +ex