Skip to content

Commit

Permalink
Chore(ci): Introduce new release workflow
Browse files Browse the repository at this point in the history
refs #DS-1434
  • Loading branch information
literat committed Oct 4, 2024
1 parent 03c2497 commit a42bdca
Showing 1 changed file with 88 additions and 0 deletions.
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:
- 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 }}'

0 comments on commit a42bdca

Please sign in to comment.