-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create PRs to reflect publish changes (#743)
* Create PRs to reflect publish changes * Using gh instead of third party action * Adding github token
- Loading branch information
Showing
1 changed file
with
37 additions
and
17 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,19 +1,21 @@ | ||
name: publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ci_status: | ||
description: 'required CI status' | ||
default: 'success' | ||
required: true | ||
prerelease: | ||
description: 'prerelease name' | ||
required: false | ||
workflow_dispatch: | ||
inputs: | ||
ci_status: | ||
description: 'required CI status' | ||
default: 'success' | ||
required: true | ||
prerelease: | ||
description: 'prerelease name' | ||
required: false | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
PublishBranch: publish/${{github.ref_name }}-${{ github.run_id }}-${{ github.run_number }} | ||
steps: | ||
- name: 'check successful status' | ||
run: | | ||
|
@@ -28,16 +30,20 @@ jobs: | |
version: nightly | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.ref }} | ||
fetch-depth: 0 | ||
ref: ${{ github.ref }} | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
node-version: 16 | ||
- uses: actions/setup-python@v2 | ||
- name: 'configure git' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Actions" | ||
- name: 'Checkout new branch' | ||
run: | | ||
git checkout -b $PublishBranch | ||
git push -u origin $PublishBranch | ||
- name: 'install dependencies' | ||
run: | | ||
yarn -D | ||
|
@@ -49,9 +55,23 @@ jobs: | |
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
GITHUB_TOKEN: ${{ github.token }} | ||
PUBLISH_PRERELEASE: ${{ github.event.inputs.prerelease }} | ||
- name: 'merge into main branch' | ||
if: github.event.inputs.prerelease == '' # unless it's a prerelease | ||
- name: 'Create PR to merge into ref branch' | ||
run: | | ||
gh pr create \ | ||
-B ${{ github.ref_name }} \ | ||
-H $PublishBranch \ | ||
--title "Publish: CHANGELOG and Package Version Updates into ${{ github.ref_name }}" \ | ||
--body "Syncing CHANGELOG and package version updates from publish action ${{github.run_id}}-${{github.run_number}} into ${{ github.ref_name}} branch" \ | ||
--reviewer ${{ github.actor }} | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
- name: 'Create PR to merge ref branch into main' | ||
run: | | ||
git checkout main && \ | ||
git merge ${{ github.ref }} && \ | ||
git push | ||
gh pr create \ | ||
-B main \ | ||
-H ${{ github.ref_name }} \ | ||
--title "Publish: Sync ${{ github.ref_name }} into main " \ | ||
--body "Syncing ${{ github.ref_name }} back into main after publish action. NOTE: this PR should be merged after CHANGELOG and package version updates have been merged into ${{ github.ref_name }}" \ | ||
--reviewer ${{ github.actor }} | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |