Skip to content

Commit

Permalink
>>>>
Browse files Browse the repository at this point in the history
  • Loading branch information
rindeal committed Mar 17, 2024
1 parent ab8c506 commit 6c316cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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 ]
Expand All @@ -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 ]
Expand All @@ -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 }}"
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 6c316cf

Please sign in to comment.