Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cd): Refactor create release and cd action #200

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
name: CD

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
types:
- closed
branches:
- 'release/[0-9]+.[0-9]+.[0-9]+'

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

jobs:
create-repository-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Get Version
id: version
env:
BRANCH_NAME: ${{ github.ref_name }}
run: echo "VERSION=${BRANCH_NAME:9}" >> $GITHUB_OUTPUT

- name: Create release PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ steps.version.outputs.VERSION }} --generate-notes


publish-packages:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

strategy:
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,7 @@ jobs:
node-version: [20.x]

steps:
- name: fetch app token
id: fetch-app-token
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
token: ${{ steps.fetch-app-token.outputs.token }}

- name: Setup PNPM
uses: pnpm/[email protected]
Expand All @@ -44,8 +35,7 @@ jobs:
git config --global user.name "${{ github.event.sender.login }}"

- name: Apply standard-version
run: |
standard-version -t "" --no-verify --first-release
run: standard-version -t "" --no-verify --first-release

- name: Get new version
id: version
Expand All @@ -60,12 +50,18 @@ jobs:
run: |
git add .
git commit --no-verify -m "chore(release): ${{ steps.version.outputs.VERSION }}"
git checkout -b release/${{ steps.version.outputs.VERSION }}
git tag ${{ steps.version.outputs.VERSION }}
git push --force
git push origin release/${{ steps.version.outputs.VERSION }}
git push --tags

- name: Create release
- name: Create release PR
env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.version.outputs.VERSION }} --generate-notes
gh pr create \
--title "chore(release): ${{ steps.version.outputs.VERSION }}" \
--body "chore(release): ${{ steps.version.outputs.VERSION }}" \
--base master \
--head release/${{ steps.version.outputs.VERSION }} \
--label release