Merge pull request #47 from omnisat/hath #47
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
name: Release | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Ensure full history is fetched so changesets can check other branches | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8.6.6 | |
- name: Install dependencies | |
run: pnpm install | |
# Check if lasereyes package has changed | |
- name: Check if lasereyes package changed | |
id: lasereyes-changes | |
run: | | |
changed="false" | |
if git diff --name-only HEAD^ HEAD | grep "packages/lasereyes"; then | |
changed="true" | |
fi | |
echo "changed=$changed" >> $GITHUB_ENV | |
# Add a 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 for changeset to properly check | |
- name: Fetch all branches | |
run: git fetch --all | |
# Check if already in pre-release mode on dev | |
- name: Check pre-release mode | |
run: | | |
if pnpm changeset status | grep -q "pre mode"; then | |
echo "Already in pre-release mode, exiting pre mode..." | |
pnpm changeset pre exit | |
fi | |
# Run Changesets pre-release mode for RC | |
- name: Run Changesets pre-release mode for RC | |
if: github.ref == 'refs/heads/dev' && env.changed == 'true' | |
run: pnpm changeset pre enter rc | |
# Commit version bumps and changelog | |
- name: Commit version bumps and changelog | |
if: github.ref == 'refs/heads/dev' && 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 "Release version bump for lasereyes" | |
git push origin main |