1.0.0 #4
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
name: π Publish | |
on: | |
release: | |
types: [created] | |
jobs: | |
npm-publish: | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout | |
uses: actions/checkout@v3 | |
- name: π’ Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- name: π½ Install | |
run: yarn install --frozen-lockfile | |
- name: π οΈ Build | |
run: yarn build | |
- name: π Publish | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} | |
gpr-publish: | |
name: Publish to GitHub Package Registry | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout | |
uses: actions/checkout@v3 | |
- name: Store lowercase actor name | |
run: | | |
echo 'actor_name<<EOF' >> $GITHUB_ENV | |
echo ${{ github.actor }} | tr "A-Z" "a-z" >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Store package name | |
run: | | |
echo 'package_name<<EOF' >> $GITHUB_ENV | |
grep -Po '"name": *\K"[^"]*"' package.json | grep -oP '"\K[^"\047]+(?=["\047])' >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: π’ Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '${{env.actor_name}}' | |
- name: π½ Install | |
run: yarn install --frozen-lockfile | |
- name: π οΈ Build | |
run: yarn build | |
- name: Update Package Name | |
run: | | |
sed -i 's,"name": "${{env.package_name}}","name": "@${{env.actor_name}}/${{env.package_name}}",' package.json | |
cat package.json | |
- name: π Publish | |
run: npm publish --access public | |
env: | |
CI: true | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |