Publish 4.5.3 🤖 #79
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 | |
run-name: "Publish ${{ github.event.inputs.version }} 🤖" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Updated registry version' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Validate version format | |
run: | | |
if [[ ! ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Version '${{ github.event.inputs.version }}' is not a valid semver version." | |
exit 1 | |
fi | |
- name: Checkout repository source | |
uses: actions/checkout@v3 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Configure git | |
run: | | |
git config --global user.name "Kruithne" | |
git config --global user.email "kruithne@gmail.com" | |
- name: Install dependencies | |
run: bun install | |
- name: Update package version to ${{ github.event.inputs.version }} | |
run: npm version ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }} ✨" | |
- name: Push version tag to GitHub | |
run: git push --follow-tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package to npmjs.org | |
run: npm publish --access=public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create release tarball | |
run: npm pack --output=release-${{ github.event.inputs.version }}.tgz | |
- name: Upload release package to GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
release-${{ github.event.inputs.version }}.tgz | |
tag_name: ${{ github.event.inputs.version }} | |
name: ${{ github.event.inputs.version }} | |
body: | | |
Release ${{ github.event.inputs.version }} ✨ |