Last active
January 1, 2022 10:46
-
-
Save yakovlev-alexey/b8019044854bb196307e1d7eefc663ab to your computer and use it in GitHub Desktop.
A basic GitHub Actions Workflow to automatically version and publish npm packages
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: main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Bump version | |
id: bump-version | |
uses: "yakovlev-alexey/bump-package-version-action@v1.1.0" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
major-wording: "feat!" | |
minor-wording: "feat" | |
patch-wording: "fix" | |
- name: Publish npm | |
if: steps.bump-version.outputs.version != null | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: yarn publish --non-interactive --registry https://registry.npmjs.org/ | |
- name: Tag latest | |
if: steps.bump-version.outputs.version != null && github.event_name != 'pull_request' | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: yarn tag add --non-interactive <package_name>@${{ steps.bump-version.outputs.version }} latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment