Skip to content

Commit

Permalink
fix: release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlwn123 committed Sep 6, 2024
1 parent fcdf421 commit 03973ac
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 15 deletions.
61 changes: 53 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ jobs:
name: Verify
uses: ./.github/workflows/verify.yml

release:
name: Release
permissions:
contents: write
id-token: write
pull-requests: write
publish-github:
name: Release Github Packages
needs: verify
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
Expand All @@ -29,22 +27,69 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/install-deps

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
registry-url: 'https://npm.pkg.github.com'

- name: Create Release Pull Request
uses: changesets/action@v1
with:
publish: pnpm release
createGithubReleases: ${{ github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish prerelease
if: steps.changesets.outputs.published != 'true'
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm config set "//npm.pkg.github.com/:_authToken" "$NODE_AUTH_TOKEN"
git reset --hard origin/main
pnpm clean
pnpm changeset version --no-git-tag --snapshot canary
pnpm changeset publish --no-git-tag --snapshot canary --tag canary
publish-npmjs:
name: Release npmjs.com
needs: verify
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-deps

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'

- name: Create Release Pull Request
uses: changesets/action@v1
with:
publish: pnpm release
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish prerelease
if: steps.changesets.outputs.published != 'true'
continue-on-error: true
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
npm config set "//registry.npmjs.org/:_authToken" "$NODE_AUTH_TOKEN"
git reset --hard origin/main
pnpm clean
pnpm changeset version --no-git-tag --snapshot canary
Expand Down
5 changes: 0 additions & 5 deletions .npmrc

This file was deleted.

3 changes: 2 additions & 1 deletion packages/core-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"typescript": "^5.2.2"
},
"publishConfig": {
"access": "public"
"access": "public",
"registry": "https://npm.pkg.github.com"
}
}
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03973ac

Please sign in to comment.