-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f2014f
commit 7b73bc8
Showing
1 changed file
with
28 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,33 +18,41 @@ jobs: | |
with: | ||
node-version: "20" | ||
|
||
- name: Install jq | ||
run: sudo apt-get install -y jq | ||
|
||
- name: Install pnpm | ||
- name: Install dependencies | ||
run: | | ||
npm install -g pnpm | ||
pnpm config set store-dir ~/.pnpm-store | ||
pnpm install | ||
- name: Cache pnpm store | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Install gh CLI | ||
run: sudo apt-get install -y gh | ||
|
||
- name: Update version in package.json | ||
if: github.ref_type == 'branch' | ||
- name: Authenticate gh CLI | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
jq --arg build "$GITHUB_RUN_NUMBER" --arg commit "${GITHUB_SHA::8}" \ | ||
'.version = .version + "-dev." + $build + "+" + $commit' package.json > package.json.tmp | ||
mv package.json.tmp package.json | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
- name: Release | ||
- name: Run semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: pnpm run release | ||
|
||
- name: Check for changes | ||
id: git_diff | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git checkout -b release-branch | ||
git add CHANGELOG.md package.json | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git commit -m "chore(release): Create release PR" | ||
echo "true" > has_changes.txt | ||
else | ||
echo "false" > has_changes.txt | ||
fi | ||
- name: Create Pull Request | ||
if: steps.git_diff.outputs.has_changes == 'true' | ||
run: | | ||
gh pr create --title "Release PR" --body "This PR includes changes for the new release." --head release-branch --base main |