Skip to content

Commit

Permalink
Merge pull request #39 from omnisat/hath
Browse files Browse the repository at this point in the history
trigger
  • Loading branch information
hathbanger authored Oct 12, 2024
2 parents 51301c6 + bcd0fe7 commit 2c7037e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 71 deletions.
95 changes: 26 additions & 69 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ on:
- dev
- main

permissions:
contents: write # Grants write permissions to push commits

jobs:
changeset-rc-version:
detect-changes-and-version:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -32,90 +26,65 @@ jobs:
- name: Install dependencies
run: pnpm install

# Check if lasereyes package has changed
- name: Check if lasereyes package changed
id: lasereyes-changes
run: |
if git diff --name-only HEAD^1 HEAD | grep -q "packages/lasereyes/"; then
echo "Lasereyes package changed."
echo "::set-output name=changed::true"
else
echo "Lasereyes package did not change."
echo "::set-output name=changed::false"
fi
# Check if already in pre-release mode, and exit if necessary
- name: Exit pre-release mode if active
if: steps.lasereyes-changes.outputs.changed == 'true'
id: check_changes
run: |
if [ -f ".changeset/pre.json" ]; then
echo "Exiting pre-release mode"
pnpm dlx @changesets/cli pre exit
else
echo "Not in pre-release mode"
fi
- name: Check if any files were changed
git diff --quiet HEAD^ HEAD -- packages/lasereyes || echo "changed=true" >> $GITHUB_ENV
# Automatically add a changeset if changes are detected
- name: Add Changeset if lasereyes package changed
if: env.changed == 'true'
run: |
git status
git diff
pnpm dlx changeset add --empty --force --commit \
--message "chore: auto-bump lasereyes version"
# Enter pre-release mode and version bump for lasereyes package
# Enter pre-release mode for RC if on dev
- name: Run Changesets pre-release mode for RC
if: steps.lasereyes-changes.outputs.changed == 'true'
if: github.ref == 'refs/heads/dev' && env.changed == 'true'
run: |
pnpm dlx @changesets/cli pre enter rc # Enter RC mode
pnpm dlx @changesets/cli version # Bump RC version for lasereyes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pnpm dlx @changesets/cli pre enter rc
pnpm dlx @changesets/cli version
# Commit version bump
- 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 .changeset/pre.json
git add .
git commit -m "RC version bump for lasereyes"
git push origin dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-rc-release:
runs-on: ubuntu-latest
needs: changeset-rc-version
if: needs.changeset-rc-version.outputs.changed == 'true'
needs: detect-changes-and-version
if: github.ref == 'refs/heads/dev' && env.changed == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.6

- name: Install dependencies
run: pnpm install

# Publish only the lasereyes RC version to npm
- name: Publish RC to npm
run: pnpm publish --tag rc --access public --filter "lasereyes"
run: pnpm publish --tag rc --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

changeset-stable-version:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.changed == 'true'
needs: publish-rc-release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -130,55 +99,43 @@ jobs:
- name: Install dependencies
run: pnpm install

# Exit pre-release mode
- name: Exit RC mode
- name: Exit pre-release mode
run: pnpm dlx @changesets/cli pre exit

# Run Changesets version to bump versions and generate changelogs for stable release
- name: Run Changesets version
- name: Run Changesets version for stable
run: pnpm dlx @changesets/cli version

# Commit the stable version bump and changelog
- name: Commit version bumps and changelog
- name: Commit version bumps and changelog for stable
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 "Stable version bump"
git commit -m "Stable version bump for lasereyes"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-stable-release:
runs-on: ubuntu-latest
needs: changeset-stable-version
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.changed == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.6

- name: Install dependencies
run: pnpm install

# Publish the stable version of lasereyes to npm
- name: Publish stable release to npm
run: pnpm publish --access public --filter "lasereyes"
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Create a GitHub Release with the summarized release notes
- name: Create GitHub Release
uses: actions/create-release@v1
with:
Expand Down
2 changes: 0 additions & 2 deletions packages/lasereyes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ For help, discussion about best practices, or any other conversation that would

## Contributing



Contributions to Lasereyes are greatly appreciated! If you're interested in contributing to Lasereyes, please read the [Contributing Guide](https://wagmi.sh/dev/contributing) **before submitting a pull request**.

## Sponsors
Expand Down

0 comments on commit 2c7037e

Please sign in to comment.