Skip to content

Commit 9ffc7e4

Browse files
committed
ci: update release workflow
1 parent c0f8408 commit 9ffc7e4

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

.github/workflows/release.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
jobs:
1717
npm:
1818
runs-on: ubuntu-latest
19-
2019
steps:
2120
- uses: actions/checkout@v4
2221
with:
@@ -43,12 +42,12 @@ jobs:
4342
env:
4443
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4544

46-
# TODO: uncomment
47-
# run: yarn changelogithub
48-
# env:
49-
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
45+
- run: yarn changelogithub
46+
env:
47+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
5048

5149
forge:
50+
runs-on: ubuntu-latest
5251
steps:
5352
- uses: actions/checkout@v4
5453
- uses: fregante/setup-git-user@v2.0.1

scripts/publish-for-forge.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,26 @@ clean() {
1919
maybe_publish_forge_pkg() {
2020
pkg="$1"
2121
version=$(jq -r '.version' "packages/$pkg/package.json")
22-
current_branch=$(git branch --show-current)
2322
latest_commit_msg=$(git log -1 --pretty=%B)
2423

2524
git checkout -b "$pkg"
2625
# return early if latest already published
2726
[ "$latest_commit_msg" = "$version" ] && return
28-
git status
29-
git pull --rebase origin "$pkg"
27+
git pull --rebase origin "$pkg" 2>/dev/null || true
3028
clean "$pkg"
31-
mv "packages/$pkg"/src .
32-
mv "packages/$pkg"/README.md .
29+
mkdir "$pkg"
30+
mv "packages/$pkg"/src "$pkg"
31+
mv "packages/$pkg"/README.md "$pkg"
32+
mv LICENSE "$pkg"
3333
rm -fr "packages"
34-
git add src
34+
git add "$pkg"
3535
git commit -am "$version"
3636
git push origin "$pkg"
37-
git checkout "$current_branch"
37+
git checkout origin/"$GITHUB_HEAD_REF"
3838
}
3939

4040
main() {
41+
git fetch origin "$GITHUB_HEAD_REF"
4142
# http://mywiki.wooledge.org/BashFAQ/001
4243
# https://github.com/koalaman/shellcheck/wiki/SC2012
4344
find packages -maxdepth 1 -mindepth 1 -printf '%P\n' | while read -r pkg; do

0 commit comments

Comments
 (0)