Skip to content

Commit

Permalink
ci: cd production version [SFUI2-1185] (#2839)
Browse files Browse the repository at this point in the history
once any commit lands into v2 branch yarn changeset publish of package should happen
if error happens, exit - do nothing
if no error, then create automatically PR with changes (changelog) v2 -> v2-develop
if no conflicts then automerge
if conflict resolve it manually
in any case of adding extra commit, PR action rerun and if no conflicts, the will automerge
  • Loading branch information
Szymon-dziewonski authored and FRSgit committed Jun 23, 2023
1 parent 6b0d33e commit c524ee4
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 44 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/cd-v2-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Helper - Auto-merge PR with `automerge` label
on:
pull_request:
types:
- opened
- labeled
- reopened
- synchronize
- ready_for_review
- edited
branches:
- v2-develop

jobs:
automerge:
runs-on: ubuntu-latest
if: ${{ startsWith(github.head_ref, 'v2' )}}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- id: automerge
name: automerge
uses: 'pascalgn/[email protected]'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
37 changes: 37 additions & 0 deletions .github/workflows/cd-v2-publish-and-create-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish prod version and create sync PR
on:
push:
branches:
- v2

jobs:
publish-and-create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn --immutable
- name: Publish Production version
# run: yarn changeset publish
run: echo publish package
env:
# Needs access to publish to npm
# refresh token before Saturday, May 25, 2024
NPM_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}
- name: Create PR to develop
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create -B v2-develop --title 'chore: automatic Sync v2->v2-develop PR' --body 'This Pull Request is generated automatically with changes pushed into `v2` branch. `v2` and `v2-develop` branches should be in-sync.' --label automerge || true
- name: Merge created PR
env:
GH_TOKEN: ${{ github.token }}
run: gh pr merge --auto --merge
44 changes: 0 additions & 44 deletions .github/workflows/exit-pre-mode-on-comment.yml

This file was deleted.

0 comments on commit c524ee4

Please sign in to comment.