Add flags to print CLI usage help message and version #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
get-release-version: | |
if: ${{ (startsWith(github.event.pull_request.head.ref, 'release/')) && (github.event.pull_request.merged == true) }} | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} | |
steps: | |
- name: Extract version from branch name | |
id: release-version | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
echo "RELEASE_VERSION=${BRANCH_NAME#release/}" >> $GITHUB_OUTPUT | |
publish-release-to-github: | |
needs: get-release-version | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: read | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Get release version | |
run: | | |
echo "RELEASE_VERSION=${{ needs.get-release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | |
- name: Build changelog | |
id: build_changelog | |
uses: mikepenz/[email protected] | |
with: | |
configurationJson: | | |
{ | |
"categories": [ | |
{ | |
"title": "## 🚀 Features", | |
"labels": ["type: feature"], | |
"exclude_labels": ["package: patch", "package: potts"] | |
}, | |
{ | |
"title": "### Features: `patch`", | |
"labels": ["type: feature", "package: patch"], | |
"exclude_labels": ["package: potts"], | |
"exhaustive": true | |
}, | |
{ | |
"title": "### Features: `potts`", | |
"labels": ["type: feature", "package: potts"], | |
"exclude_labels": ["package: patch"], | |
"exhaustive": true | |
}, | |
{ | |
"title": "## 🐛 Bug fixes", | |
"labels": ["type: bug"] | |
}, | |
{ | |
"title": "## 🧪 Tests", | |
"labels": ["type: test"] | |
}, | |
{ | |
"title": "## 📓 Documentation", | |
"labels": ["type: docs"] | |
}, | |
{ | |
"title": "## 📁 Admin", | |
"labels": ["type: admin"] | |
} | |
], | |
"template": "#{{CHANGELOG}}---\n\n**Full Changelog**: https://github.com/${{ github.repository }}/compare/#{{FROM_TAG}}...${{ env.RELEASE_VERSION }}\n", | |
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in #{{URL}}" | |
} | |
toTag: ${{ github.event.pull_request.merge_commit_sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
commit: ${{ github.event.pull_request.merge_commit_sha }} | |
tag: ${{ env.RELEASE_VERSION }} | |
name: ${{ env.RELEASE_VERSION }} | |
body: ${{ steps.build_changelog.outputs.changelog }} | |
update-version-badge: | |
needs: get-release-version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Get release version | |
run: | | |
echo "RELEASE_VERSION=${{ needs.get-release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | |
- name: Generate version badge | |
if: success() | |
uses: knightdave/[email protected] | |
with: | |
file: docs/badges/version.svg | |
label: version | |
value: ${{ env.RELEASE_VERSION }} | |
color: teal | |
template: docs/badges/template.svg | |
overwrite: true | |
- name: Publish badge | |
if: success() | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: docs/badges | |
target-folder: badges | |
clean: false |