ci: use package.json#packageManager #57
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: Release | |
on: | |
push: | |
branches: [master, develop] | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: Release | |
if: ( | |
github.repository_owner == 'pvtnbr' && github.ref_name =='develop' | |
) || ( | |
github.repository_owner == 'privatenumber' && github.ref_name =='master' | |
) | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
run_install: true | |
- name: Lint | |
run: pnpm lint | |
- name: Prerelease to GitHub | |
if: github.repository_owner == 'pvtnbr' | |
run: | | |
git remote add public https://github.com/$(echo $GITHUB_REPOSITORY | sed "s/^pvtnbr/privatenumber/") | |
git fetch public master 'refs/tags/*:refs/tags/*' | |
git push --force --tags origin refs/remotes/public/master:refs/heads/master | |
jq ' | |
.publishConfig.registry = "https://npm.pkg.github.com" | |
| .name = ("@" + env.GITHUB_REPOSITORY_OWNER + "/" + .name) | |
| .repository = env.GITHUB_REPOSITORY | |
| .release.branches = [ | |
"master", | |
{ name: "develop", prerelease: "rc", channel: "latest" } | |
] | |
' package.json > _package.json | |
mv _package.json package.json | |
- name: Release | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: pnpm dlx semantic-release |