-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from nomic-ai/nom-1729-next-releases
Nom 1729 next releases
- Loading branch information
Showing
1 changed file
with
48 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
name: Publish @next release to npm | ||
name: Publish to npm | ||
on: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
deployments: write | ||
|
||
jobs: | ||
publish: | ||
publish-next: | ||
if: github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
@@ -23,13 +26,48 @@ jobs: | |
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
- run: npm version prerelease --preid=next | ||
- name: Commit bumped version | ||
- name: Get latest version and bump | ||
run: | | ||
# git add package.json package-lock.json | ||
# git commit -m "Bump version to $(node -p "require('./package.json').version")" | ||
git push | ||
LATEST_VERSION=$(npm view . version) | ||
npm version $LATEST_VERSION --no-git-tag-version | ||
npm version prerelease --preid=next | ||
- run: npm publish --tag next | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | ||
|
||
publish-release: | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Configure Git | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
- run: npm ci | ||
- name: Update version and commit | ||
run: | | ||
npm version ${{ github.event.release.tag_name }} --no-git-tag-version | ||
git add package.json package-lock.json | ||
git commit -m "Bump version to ${{ github.event.release.tag_name }}" | ||
git push | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | ||
- name: Update release notes | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
github.rest.repos.updateRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: context.payload.release.id, | ||
body: context.payload.release.body + '\n\nThis release has been published to npm.' | ||
}) |