77jobs :
88 build :
99 runs-on : ubuntu-latest
10+ strategy :
11+ matrix :
12+ package-name : [use-memo-map]
13+
1014 steps :
1115 - uses : actions/checkout@v3
1216 - name : Use Node.js 16
@@ -19,13 +23,13 @@ jobs:
1923 run : echo version=`cat package.json | jq -r '.version'` >> $GITHUB_OUTPUT
2024 - name : Propagate versions
2125 run : |
22- cd packages/use-memo-map
26+ cd packages/${{ matrix.package-name }}
2327 npm version --no-git-tag-version ${{ steps.read-package-json.outputs.version }}
2428 - run : npm clean-install
2529 - run : npm run build --if-present
2630 - name : Run npm pack
2731 run : |
28- cd packages/use-memo-map
32+ cd packages/${{ matrix.package-name }}
2933 npm pack
3034 - name : Upload changelog artifact
313536403741 with :
3842 name : tarball
39- path : packages/use-memo-map/*.tgz
43+ path : packages/${{ matrix.package-name }}/*.tgz
44+ - name : Build pages
45+ run : |
46+ cd packages/pages
47+ npm install ../${{ matrix.package-name }}/*.tgz
48+ npm run build
49+ - name : Upload pages artifact
50+ uses : actions/upload-pages-artifact@v1
51+ with :
52+ path : packages/pages/public
4053
4154 draft-release :
4255 needs :
8295 run : |
8396 echo ::error::Cannot publish prerelease version ${{ steps.read-package-json.outputs.version }}
8497 exit 1
85- # - run: npm publish `ls ./*.tgz`
86- # env:
87- # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
98+ - run : npm publish `ls ./*.tgz`
99+ env :
100+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
88101 - name : Summarize job
89102 run : echo NPM package published to https://npmjs.com/package/${{ steps.read-package-json.outputs.package-name }}/v/${{ steps.read-package-json.outputs.version }}. >> $GITHUB_STEP_SUMMARY
90103
@@ -104,6 +117,8 @@ jobs:
104117 run : echo GitHub release created at https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}. >> $GITHUB_STEP_SUMMARY
105118
106119 create-bump-pull-request :
120+ continue-on-error : true
121+ environment : production
107122 needs :
108123 - publish-package
109124 permissions :
@@ -126,20 +141,43 @@ jobs:
126141 npm version prepatch --no-git-tag-version
127142 echo version=`cat package.json | jq -r .version` >> $GITHUB_OUTPUT
128143 - name : Create branch
144+ id : create-branch
129145 run : |
130- git checkout -b bump-${{ steps.bump-version.outputs.version }}
146+ BRANCH_NAME=bump-${{ steps.bump-version.outputs.version }}
147+ echo branch-name=$BRANCH_NAME >> $GITHUB_OUTPUT
148+
149+ git checkout -b $BRANCH_NAME
131150 git add --all
132151 git commit --message "Bump to ${{ steps.bump-version.outputs.version }}"
133- git push --set-upstream origin bump-${{ steps.bump-version.outputs.version }}
134- - env :
135- GH_TOKEN : ${{ github.token }}
152+ git push --set-upstream origin $BRANCH_NAME
153+ - continue-on-error : true
154+ env :
155+ GH_TOKEN : ${{ secrets.GH_TOKEN_CREATE_PULL_REQUEST }}
136156 id : create-pull-request
137157 name : Create pull request
138- run : echo url=`gh pr create --assignee ${{ github.actor }} --base main --body "" --title "Bump to ${{ steps.bump-version.outputs.version }}" || true` >> $GITHUB_OUTPUT
158+ run : |
159+ PULL_REQUEST_NUMBER=`gh api repos/${{ github.repository }}/pulls --field base=main --field head=${{ steps.create-branch.outputs.branch-name }} --field title="Bump to ${{ steps.bump-version.outputs.version }}" | jq -r '.number'`
160+ gh api repos/${{ github.repository }}/issues/$PULL_REQUEST_NUMBER/assignees --field assignees[]=${{ github.actor }}
161+ echo url=https://github.com/${{ github.repository }}/pull/$PULL_REQUEST_NUMBER >> $GITHUB_OUTPUT
139162 - name : Summarize job
140163 run : |
141164 if [ "${{ steps.create-pull-request.outputs.url }}" = "" ]; then
142- echo "Branch created at [bump-${{ steps.bump-version.outputs.version }}](https://github.com/${{ github.repository }}/compare/main...bump- ${{ steps.bump-version .outputs.version }})" >> $GITHUB_STEP_SUMMARY
165+ echo "Branch created at [bump-${{ steps.bump-version.outputs.version }}](https://github.com/${{ github.repository }}/compare/main...${{ steps.create-branch .outputs.branch-name }})" >> $GITHUB_STEP_SUMMARY
143166 else
144167 echo Pull request created at ${{ steps.create-pull-request.outputs.url }}. >> $GITHUB_STEP_SUMMARY
145168 fi
169+
170+ publish-pages :
171+ environment :
172+ name : github-pages
173+ url : ${{ steps.deployment.outputs.page_url }}
174+ needs : build
175+ permissions :
176+ pages : write
177+ id-token : write
178+ runs-on : ubuntu-latest
179+
180+ steps :
181+ - id : deployment
182+ name : Deploy to GitHub Pages
183+ uses : actions/deploy-pages@v2
0 commit comments