[publish] 1.0.1 #2
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: publisher | |
on: | |
pull_request_target: | |
branches: | |
- main | |
types: [closed] | |
jobs: | |
publisher: | |
name: publisher | |
runs-on: ubuntu-latest | |
steps: | |
- name: check if event is merge | |
run: | | |
if [ "${{ github.event.pull_request.merged }}" != "true" ]; then | |
exit 1 | |
fi | |
- name: title checker | |
uses: thehanimo/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
configuration_path: ".github/check-pr-tilte-publish.json" | |
- name: get main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org/' | |
scope: '@mathcovax' | |
- name: install dependencies | |
run: npm ci --prefix .github/getVersion/ | |
- name: get version | |
run: | | |
OUTPUT=$(node .github/getVersion/main.js) | |
echo "::set-env name=VERSION::$OUTPUT" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_OWNER: duplojs | |
GITHUB_REPO: duplojs-zod-accelerator | |
GITHUB_BRANCHE: develop | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
- name: see Version | |
run: | | |
echo $VERSION | |
- name: set Version In package.json | |
run: | | |
sed -i 's/"version":.*".*"/"version": "'$(echo $VERSION)'"/' package.json | |
- name: install dependencies | |
run: npm ci | |
- name: build | |
run: npm run build | |
- name: Publish to NPM | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |