Skip to content

Commit

Permalink
docs(changeset): releases
Browse files Browse the repository at this point in the history
  • Loading branch information
WoLfulus committed Mar 17, 2024
1 parent f24a0e9 commit 33eb7a1
Show file tree
Hide file tree
Showing 39 changed files with 1,904 additions and 1,655 deletions.
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"fixed": [],
"fixed": [["*"]],
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Tag and Publish

on:
push:
branches:
- main

jobs:
changed:
runs-on: ubuntu-latest
outputs:
pkg: ${{ steps.changes.outputs.pkg }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
pkg:
- 'package.json'
check-version:
name: publish
needs: changed
runs-on: ubuntu-latest
if: needs.changed.outputs.pkg == 'true'
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
sparse-checkout-cone-mode: false
sparse-checkout: |
package.json
- id: current_version
name: Read current version
run: |
PACKAGE_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json').toString()).version)")
echo "::debug::Current version: [${PACKAGE_VERSION}]"
echo "value=${PACKAGE_VERSION}" > $GITHUB_OUTPUT
- name: Checkout previous commit
run: git checkout HEAD^

- id: previous_version
name: Read previous version
run: |
PACKAGE_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json').toString()).version)")
echo "::debug::Previous version: [${PACKAGE_VERSION}]"
echo "value=${PACKAGE_VERSION}" > $GITHUB_OUTPUT
- name: Tag if needed
if: steps.current_version.outputs.value != steps.previous_version.outputs.value
env:
CURRENT_VERSION: ${{ steps.current_version.outputs.value}}
run: |
git config --global user.name "Black Rabbit"
git config --global user.email "[email protected]"
git tag -a v${CURRENT_VERSION} -m "v${CURRENT_VERSION}"
git push origin v${CURRENT_VERSION}
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Clone settings
run: |
git config --global core.eol lf
git config --global core.autocrlf false
- name: Clone repository
uses: actions/checkout@v4

- name: Reset files
run: |
git clean -ffdx && git reset --hard HEAD
- name: Install PNPM
uses: pnpm/action-setup@v3
with:
version: 8

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'

- name: Install PNPM
run: corepack enable pnpm

- name: Install dependencies
run: pnpm install

- id: versions
name: Check versions
run: |
export HUSKY=0
PACKAGE_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json').toString()).version)")
echo "::debug::Current version: [${PACKAGE_VERSION}]"
echo "current_version=${PACKAGE_VERSION}\n" > $GITHUB_OUTPUT
pnpm changeset version
PACKAGE_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json').toString()).version)")
echo "::debug::Next version: [${PACKAGE_VERSION}]"
echo "next_version=${PACKAGE_VERSION}\n" > $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: Release ${{ steps.version.outputs.versions_inline }}
committer: Black Rabbit <[email protected]>
commit-message: "apply changesets"
body: |
Apply changesets to prepare for the next release.
branch: release
delete-branch: true
assignees: wolfulus

Loading

0 comments on commit 33eb7a1

Please sign in to comment.