Create Release #16
This file contains hidden or 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: Create Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version (SemVer)" | |
required: true | |
default: 0.0.0 | |
jobs: | |
set-version: | |
name: Update version in documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Install required dependencies | |
run: npm install | |
- name: Update package version | |
run: npm version ${{ github.event.inputs.version }} --git-tag-version=false | |
- name: Update README | |
run: npm run generate-readme ${{ github.event.inputs.version }} | |
- name: Add corresponding commit | |
run: | | |
git config --global user.name 'OpenFoxes Maintenance Bot' | |
git config --global user.email '[email protected]' | |
git init | |
git add . | |
git commit -m "🔖 Release ${{ github.event.inputs.version }}" -m "- Updated documentation" | |
git tag v${{ github.event.inputs.version }} | |
git push -u origin HEAD:main --tags | |
create-npm-release: | |
name: "Create NPM release" | |
runs-on: ubuntu-latest | |
needs: [set-version] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Prepare NPM credentials | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc | |
echo email=${{ secrets.NPM_EMAIL }} >> .npmrc | |
echo always-auth=true >> .npmrc | |
npm version ${{ github.event.inputs.version }} --git-tag-version=false | |
- name: Publish to NPM | |
run: npm publish --access=public --verbose | |
create-github-release: | |
name: "Create GitHub release" | |
runs-on: ubuntu-latest | |
needs: [create-npm-release] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.ACTION_TOKEN }} | |
name: Version ${{ github.event.inputs.version }} | |
tag_name: v${{ github.event.inputs.version }} |