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(ci): Introduce new preversion and graduate targets for creating a prerelease version #1686

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
88 changes: 88 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: 🎉 Release

on:
push:
branches:
- 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 "release-bot@almacareer.com"
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next is distribution channel.

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
run: |
gh pr create \
-B ${{ env.BRANCH_NAME }} \
-H ${{ needs.release-branch.outputs.release-branch }} \
--title '🎉 Release' \
--body 'Automated release PR for ${{ env.BRANCH_NAME }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading