From cc12484a5e99491dad54c39bca6bd0c1a9c5c6bb Mon Sep 17 00:00:00 2001 From: "Xuan (Sean) Hu" Date: Thu, 14 Sep 2023 17:52:20 +0800 Subject: [PATCH] ci: Fix release workflow for GitHub Actions. (#163) --- .github/workflows/release.yml | 23 +++++++------------ Makefile | 6 ++++- template/Makefile.jinja | 6 ++++- .../workflows/release.yml.jinja | 23 +++++++------------ 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a255d08..55565583 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,20 +16,7 @@ jobs: TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} TWINE_USERNAME: ${{ vars.TWINE_USERNAME }} run: make upload - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install git-changelog using pipx - run: pipx install git-changelog - - name: Prepare release notes - run: git-changelog --release-notes > release-notes.md - - name: Create GitHub release - uses: softprops/action-gh-release@v1 - with: - body_path: release-notes.md - prerelease: ${{ startsWith(github.ref, 'refs/tags/v0') }} - pages-build: + pages-build-with-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -43,12 +30,18 @@ jobs: - run: env | sort - run: make dev-docs - run: make docs + - run: make release-notes > release-notes.md + - name: Create GitHub release + uses: softprops/action-gh-release@v1 + with: + body_path: release-notes.md + prerelease: ${{ startsWith(github.ref, 'refs/tags/v0') }} - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 with: path: public pages-deploy: - needs: pages-build + needs: pages-build-with-release permissions: pages: write id-token: write diff --git a/Makefile b/Makefile index 45b56894..3d049955 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,11 @@ changelog: echo "Existing Changelog found at '$(CHANGELOG_URL)', download for incremental generation."; \ wget -q -O $(CHANGELOG_PATH) $(CHANGELOG_URL); \ fi - $(PIPRUN) git-changelog -ETrio docs/changelog.md -c conventional -s build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test + $(PIPRUN) git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test + +# Generate release notes from changelog. +release-notes: + $(PIPRUN) git-changelog --input $(CHANGELOG_PATH) --release-notes # Build documentation only from src. docs-gen: diff --git a/template/Makefile.jinja b/template/Makefile.jinja index 66477cef..63049eae 100644 --- a/template/Makefile.jinja +++ b/template/Makefile.jinja @@ -143,7 +143,11 @@ changelog: echo "Existing Changelog found at '$(CHANGELOG_URL)', download for incremental generation."; \ wget -q -O $(CHANGELOG_PATH) $(CHANGELOG_URL); \ fi - $(PIPRUN) git-changelog -ETrio docs/changelog.md -c conventional -s build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test + $(PIPRUN) git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test + +# Generate release notes from changelog. +release-notes: + $(PIPRUN) git-changelog --input $(CHANGELOG_PATH) --release-notes # Build documentation only from src. docs-gen: diff --git a/template/[% if repo_host_type == 'github.com' %].github[% endif %]/workflows/release.yml.jinja b/template/[% if repo_host_type == 'github.com' %].github[% endif %]/workflows/release.yml.jinja index ed08e6c2..4968fffa 100644 --- a/template/[% if repo_host_type == 'github.com' %].github[% endif %]/workflows/release.yml.jinja +++ b/template/[% if repo_host_type == 'github.com' %].github[% endif %]/workflows/release.yml.jinja @@ -16,20 +16,7 @@ jobs: TWINE_PASSWORD: {{ '${{ secrets.TWINE_PASSWORD }}' }} TWINE_USERNAME: {{ '${{ vars.TWINE_USERNAME }}' }} run: make upload - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install git-changelog using pipx - run: pipx install git-changelog - - name: Prepare release notes - run: git-changelog --release-notes > release-notes.md - - name: Create GitHub release - uses: softprops/action-gh-release@v1 - with: - body_path: release-notes.md - prerelease: {{ '${{ startsWith(github.ref, \'refs/tags/v0\') }}' }} - pages-build: + pages-build-with-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -43,12 +30,18 @@ jobs: - run: env | sort - run: make dev-docs - run: make docs + - run: make release-notes > release-notes.md + - name: Create GitHub release + uses: softprops/action-gh-release@v1 + with: + body_path: release-notes.md + prerelease: {{ '${{ startsWith(github.ref, \'refs/tags/v0\') }}' }} - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 with: path: public pages-deploy: - needs: pages-build + needs: pages-build-with-release permissions: pages: write id-token: write