Merge pull request #71 from aj3sh/fix/release-pr-ci-fix #8
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
# Creates a Github release and NPM publish after the merge of | |
# release PR created by release-pr.yml | |
name: 'Release' | |
on: | |
push: | |
branches: | |
- main | |
permissions: {} | |
jobs: | |
release-please: | |
permissions: | |
contents: write # to create release commit (google-github-actions/release-please-action) | |
pull-requests: write # to create release PR (google-github-actions/release-please-action) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
command: github-release | |
release-type: node | |
package-name: nepali-datetime | |
# The logic below handles the npm publication: | |
- uses: actions/checkout@v2 | |
# these if statements ensure that a publication only occurs when | |
# a new release is created: | |
if: ${{ steps.release.outputs.release_created }} | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: 'https://registry.npmjs.org' | |
if: ${{ steps.release.outputs.release_created }} | |
- name: Install Dependencies | |
run: npm ci | |
if: ${{ steps.release.outputs.release_created }} | |
- name: Build | |
run: npm run build | |
if: ${{ steps.release.outputs.release_created }} | |
- name: Publish to NPM | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
if: ${{ steps.release.outputs.release_created }} |