-
Notifications
You must be signed in to change notification settings - Fork 1
33 lines (31 loc) · 1.05 KB
/
auto-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Release Publish
on:
push:
tags:
- 'v*'
jobs:
publish_new_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: prepare yarn
run: |
corepack enable yarn
yarn config set npmScopes.paosder.npmAuthToken ${{ secrets.NPM_PUBLISH_TOKEN }}
yarn install --immutable
- uses: actions/github-script@v3
name: Modify package.json
id: new-version
with:
script: |
const fs = require('fs');
const packageJson = JSON.parse(fs.readFileSync('package.json', { encoding: 'utf-8' }));
packageJson.version = context.payload.ref.replace(/refs\/tags\/v/g, '');
console.log(`new version: ${packageJson.version}`);
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
return `v${packageJson.version}`;
- name: Publish package to npm registry
run: yarn npm publish --access public