Skip to content

Merge pull request #53 from omnisat/hath #53

Merge pull request #53 from omnisat/hath

Merge pull request #53 from omnisat/hath #53

Workflow file for this run

name: Release Workflow
on:
push:
branches:
- dev
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
# Setup pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x
# Install dependencies
- name: Install dependencies
run: pnpm install
# Check if lasereyes package changed
- name: Check if lasereyes package changed
id: lasereyes-changes
run: |
changed=$(pnpm changeset status | grep -q lasereyes && echo "true" || echo "false")
echo "changed=$changed" >> $GITHUB_ENV
# Add Changeset if lasereyes package changed
- name: Add Changeset if lasereyes package changed
if: env.changed == 'true'
run: |
pnpm changeset add --empty --force --message "chore: auto-bump lasereyes version"
# Fetch all branches
- name: Fetch all branches
run: git fetch --all
# Check if already in pre-release mode
- name: Check pre-release mode
id: pre-release-check
run: |
if pnpm changeset status | grep -q "pre mode"; then
echo "in_pre_mode=true" >> $GITHUB_ENV
else
echo "in_pre_mode=false" >> $GITHUB_ENV
# Run Changesets pre-release mode for RC if not already in pre-mode
- name: Run Changesets pre-release mode for RC
if: env.changed == 'true' && env.in_pre_mode == 'false'
run: pnpm changeset pre enter rc
# Exit pre-release mode after merge to dev
- name: Exit pre-release mode for dev
if: github.ref == 'refs/heads/dev' && env.in_pre_mode == 'true'
run: pnpm changeset pre exit
# Commit version bumps and changelog
- name: Commit version bumps and changelog
if: env.changed == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "RC version bump for lasereyes"
git push origin dev
# Run Changesets version for main
- name: Run Changesets version for main
if: github.ref == 'refs/heads/main' && env.changed == 'true'
run: pnpm changeset version
# Commit version bumps and changelog for main
- name: Commit version bumps and changelog for main
if: github.ref == 'refs/heads/main' && env.changed == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Version bump after merge to main"
git push origin main