Improve types #17
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
# Workflow for releasing package to npm registry | |
name: Release to NPM | |
on: | |
pull_request: | |
types: | |
- closed # Only run after PRs have been merged or closed | |
branches: | |
- main # Only run for PRs targeted against main branch | |
jobs: | |
release: | |
# Only run for pull requests that has been merged (not closed) and that doesn't have `skip-release` label | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'skip-release') == false | |
name: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 # fetch all commits so auto-changelog is correctly generating | |
token: ${{ secrets.BOT_ACCESS_TOKEN }} | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
scope: '@lokalise' | |
always-auth: true | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Dependencies | |
run: npm install | |
- name: Build Package | |
run: npm run build:release | |
- name: Setup git config | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "AUTO RELEASE" | |
# Apply proper semver according to github labels | |
- name: Major label detected | |
if: contains(github.event.pull_request.labels.*.name, 'major') | |
run: npm version major | |
- name: Minor label detected | |
if: contains(github.event.pull_request.labels.*.name, 'minor') | |
run: npm version minor | |
- name: Patch label detected | |
if: contains(github.event.pull_request.labels.*.name, 'patch') | |
run: npm version patch | |
- name: Git push | |
run: git push origin main && git push --tags | |
- name: Release Package | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish |