base64 prefix #61
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 npm package | |
on: | |
pull_request: | |
branches: | |
- master | |
types: [closed] | |
env: | |
# Check available versions below | |
# https://github.com/actions/node-versions/blob/main/versions-manifest.json | |
node-version: "20.x" | |
jobs: | |
publish: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
cache: "yarn" | |
node-version: ${{ env.node-version }} | |
registry-url: "https://registry.npmjs.org" | |
always-auth: true | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
id: cache_node_modules | |
with: | |
# check diff of package.json and yarn.lock | |
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }} | |
path: "**/node_modules" | |
- name: Install dependencies | |
if: steps.cache_node_modules.outputs.cache-hit != 'true' | |
run: yarn install --immutable | |
- name: Build | |
run: yarn build | |
# - name: Bump version and push tag | |
# id: tag_version | |
# uses: mathieudutour/[email protected] | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check if package version can be published | |
uses: technote-space/package-version-check-action@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PACKAGE_MANAGER: yarn | |
- name: Get new package version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@main | |
- name: Create tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ steps.package-version.outputs.current-version }} | |
message: Released ${{ steps.package-version.outputs.current-version }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.package-version.outputs.current-version }} | |
name: ${{ github.event.pull_request.title }} | |
body: ${{ github.event.pull_request.body }} | |
- name: Publish npm package | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc && yarn publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |