-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore(ci): Introduce new release workflow
refs #DS-1434
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: 🎉 Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- chore/DS-1434-prerelease-workflow | ||
- alpha | ||
- beta | ||
- next | ||
- main | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
CURRENT_DATE: $(date +%Y-%m-%d) | ||
|
||
jobs: | ||
release-branch: | ||
name: 🌱 Release Branch | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
release-branch: ${{ steps.create-branch.outputs.release-branch }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create Release Branch | ||
id: create-branch | ||
run: | | ||
RELEASE_BRANCH="release/${{ env.BRANCH_NAME }}-${{ env.CURRENT_DATE }}" | ||
git checkout -b $RELEASE_BRANCH | ||
git push --set-upstream origin $RELEASE_BRANCH | ||
echo "release-branch=$RELEASE_BRANCH" >> $GITHUB_OUTPUT | ||
version: | ||
name: 🔢 Version | ||
runs-on: ubuntu-latest | ||
|
||
needs: release-branch | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.release-branch.outputs.release-branch }} | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- name: Configure Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn --immutable --inline-builds | ||
|
||
- name: Create Version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Release Bot" | ||
if [ "${{ env.BRANCH_NAME }}" == "alpha" ]; then | ||
make preversion preid=alpha | ||
elif [ "${{ env.BRANCH_NAME }}" == "beta" ]; then | ||
make preversion preid=beta | ||
elif [ "${{ env.BRANCH_NAME }}" == "next" ]; then | ||
make preversion preid=canary | ||
elif [ "${{ env.BRANCH_NAME }}" == "main" ]; then | ||
make version | ||
fi | ||
make preversion preid=alpha | ||
git push --set-upstream origin ${{ needs.release-branch.outputs.release-branch }} && git push --tags | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ needs.release-branch.outputs.release-branch }} | ||
base: ${{ env.BRANCH_NAME }} | ||
title: 'Release ${{ env.BRANCH_NAME }} - ${{ env.CURRENT_DATE }}' | ||
body: 'Automated release PR for ${{ env.BRANCH_NAME }} on ${{ env.CURRENT_DATE }}' |