Skip to content

Commit

Permalink
fix: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kyxyes committed Feb 27, 2023
1 parent 1e261f4 commit b556057
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 19 deletions.
71 changes: 53 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,65 @@
name: Release
on:
release:
types: [created]
push:
branches:
- main
workflow_dispatch:

env:
CI: true
REGISTRY: ghcr.io

permissions:
contents: write
pull-requests: write
packages: write

jobs:
publish:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published == 'true' }}

# The published packages output from the changsets action is a stringified JSON array.
# For example: '[{"name":"@labshare/auth","version":"6.6.0"},{"name":"@labshare/auth-ui","version":"3.3.1"}]'.
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
registry-url: https://registry.npmjs.org
- name: Checkout
uses: actions/checkout@v3

- run: npm ci
- run: npm publish
- name: Configure CI Github User
run: |
git config --global user.name 'LabShare'
git config --global user.email 'LabShare@labshare.org'
git remote set-url origin https://$GITHUB_ACTOR:$GH_TOKEN@github.com/ncats/auth-monorepo
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- run: npm install
with:
npm-token: ${{secrets.NPM_INSTALL_TOKEN}}

- run: npm run typedoc
# Changesets action reuses the .npmrc if it already exists. In this case, we
# need to change to an NPM token with write access.
- run: rm ~/.npmrc
shell: "bash"

- name: Deploy pages
uses: peaceiris/actions-gh-pages@v3
- name: create and publish versions
id: changesets
uses: changesets/action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/pages
commit: "chore: update versions"
title: "chore: update versions"
publish: npm ci:publish
setupGitUser: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}


5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"test": "tsc && jest",
"typedoc": "typedoc",
"lint": "eslint --max-warnings=0 --cache .",
"prepare": "husky install"
"prepare": "husky install",
"ci:publish": "changeset publish"
},
"dependencies": {
"crypto-js": "^4.1.1",
Expand All @@ -45,6 +46,8 @@
"jwt-decode": "^3.1.2"
},
"devDependencies": {
"@changesets/changelog-git": "^0.1.13",
"@changesets/cli": "^2.25.0",
"@microsoft/api-extractor": "^7.18.10",
"@testing-library/jest-dom": "^5.16.5",
"@types/crypto-js": "^4.0.2",
Expand Down

0 comments on commit b556057

Please sign in to comment.