Skip to content

Commit

Permalink
Stage Release (#2630)
Browse files Browse the repository at this point in the history
* fix: add required token for cli

* switch back to original release job

* fix: merge upstream stage history back to dev

---------

Co-authored-by: shrunyan <shrunyan@gmail.com>
  • Loading branch information
github-actions[bot] and shrunyan authored Mar 27, 2024
1 parent 5fe91dc commit 34ed8cd
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 38 deletions.
74 changes: 38 additions & 36 deletions .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,19 @@ jobs:
SLACK_USERNAME: Deploy Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

create_stage_release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: create local branch
run: git switch --create stage
- name: push local branch to origin
run: git push -u origin stage
- name: make pr
run: gh pr create -B stage -H dev --title 'Stage Release' --body 'Created by Github action'
# create_stage_release:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v4
# - name: create local branch
# run: git switch --create stage
# - name: push local branch to origin
# run: git push -u origin stage
# - name: make pr
# run: gh pr create -B stage -H dev --title 'Stage Release' --body 'Created by Github action'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# create_stage_release:
# runs-on: ubuntu-latest
Expand Down Expand Up @@ -120,30 +122,30 @@ jobs:
# release-type: node
# target-branch: stage

# create_stage_pr:
# runs-on: ubuntu-latest
# needs: [deploy_dev]
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v2
create_stage_pr:
runs-on: ubuntu-latest
# needs: [deploy_dev]
steps:
- name: Checkout Repo
uses: actions/checkout@v4

# - name: Check if PR exists
# id: check
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# prs=$(gh pr list \
# --repo "$GITHUB_REPOSITORY" \
# --head 'dev' \
# --base 'stage' \
# --json title \
# --jq 'length')
# if ((prs > 0)); then
# echo "skip=true" >> "$GITHUB_OUTPUT"
# fi
- name: Check if PR exists
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
prs=$(gh pr list \
--repo "$GITHUB_REPOSITORY" \
--head 'dev' \
--base 'stage' \
--json title \
--jq 'length')
if ((prs > 0)); then
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
# - name: Create Stage Release
# if: "!steps.check.outputs.skip"
# run: gh pr create -B stage -H dev --title 'Stage Release' --body 'Created by Github action'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Stage Release
if: "!steps.check.outputs.skip"
run: gh pr create -B stage -H dev --title 'Stage Release' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 38 additions & 2 deletions .github/workflows/cd-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ jobs:

create_beta_pr:
runs-on: ubuntu-latest
needs: [deploy_stage]
# needs: [deploy_stage]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Check if PR exists
id: check
Expand All @@ -103,3 +103,39 @@ jobs:
run: gh pr create -B beta -H stage --title 'Beta Release' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

unify_dev_history:
runs-on: ubuntu-latest
# needs: [deploy_stage]
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Check if PR exists
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
prs=$(gh pr list \
--repo "$GITHUB_REPOSITORY" \
--head 'stage' \
--base 'dev' \
--json title \
--jq 'length')
if ((prs > 0)); then
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
- name: Merge Stage Release to Dev
if: "!steps.check.outputs.skip"
run: gh pr create -B dev -H stage --title 'Merge Stage:Dev' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# unify_dev_history:
# runs-on: ubuntu-latest
# steps:
# - id: create-dev-pr
# run: gh pr create -B dev -H stage --title 'Merge Stage:Dev' --body 'Update dev history with stage release. PR created and merged by Github action'
# - id: merge-dev-pr
# run: gh pr merge --auto --squash ${{steps.create-dev-pr.}}

0 comments on commit 34ed8cd

Please sign in to comment.