fix: Fix CI access token #98
This file contains hidden or 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: Lerna Versioning and Publish | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
jobs: | |
versioning-and-publishing: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
registry-url: 'https://registry.npmjs.org' | |
node-version: '20' | |
- name: Install dependencies | |
run: | | |
npm install -g pnpm | |
npm install -g lerna | |
pnpm install | |
- name: Configure Git identity | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Run Lerna Version and Capture Tag | |
id: version | |
run: | | |
# Save current tags before running lerna version | |
git tag > before_tags.txt | |
# Run lerna version (will only bump if relevant commits exist) | |
npx lerna version --conventional-commits --yes --no-push | |
# Save tags after lerna version | |
git tag > after_tags.txt | |
# Compare tags before and after | |
if diff before_tags.txt after_tags.txt > /dev/null; then | |
echo "published=false" >> $GITHUB_OUTPUT | |
else | |
echo "published=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Publish to npm | |
if: steps.version.outputs.published == 'true' | |
run: | | |
npx lerna publish from-package --yes | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Push commit and tag | |
if: steps.version.outputs.published == 'true' | |
run: | | |
git push origin main | |
git push origin --tags | |
- name: Dispatch to Other Repo | |
if: steps.version.outputs.published == 'true' | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.SCH_ACCESS_TOKEN }} | |
repository: SteamClientHomebrew/SteamBrew | |
event-type: on-millennium-sdk-updated |