diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3fa6f5..b6048a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,6 @@ on: jobs: npm: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 with: @@ -43,12 +42,12 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # TODO: uncomment - # run: yarn changelogithub - # env: - # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - run: yarn changelogithub + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} forge: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: fregante/setup-git-user@v2.0.1 diff --git a/scripts/publish-for-forge.sh b/scripts/publish-for-forge.sh index 76097a2..db52805 100755 --- a/scripts/publish-for-forge.sh +++ b/scripts/publish-for-forge.sh @@ -19,25 +19,26 @@ clean() { maybe_publish_forge_pkg() { pkg="$1" version=$(jq -r '.version' "packages/$pkg/package.json") - current_branch=$(git branch --show-current) latest_commit_msg=$(git log -1 --pretty=%B) git checkout -b "$pkg" # return early if latest already published [ "$latest_commit_msg" = "$version" ] && return - git status - git pull --rebase origin "$pkg" + git pull --rebase origin "$pkg" 2>/dev/null || true clean "$pkg" - mv "packages/$pkg"/src . - mv "packages/$pkg"/README.md . + mkdir "$pkg" + mv "packages/$pkg"/src "$pkg" + mv "packages/$pkg"/README.md "$pkg" + mv LICENSE "$pkg" rm -fr "packages" git add src git commit -am "$version" git push origin "$pkg" - git checkout "$current_branch" + git checkout origin/"$GITHUB_HEAD_REF" } main() { + git fetch origin "$GITHUB_HEAD_REF" # http://mywiki.wooledge.org/BashFAQ/001 # https://github.com/koalaman/shellcheck/wiki/SC2012 find packages -maxdepth 1 -mindepth 1 -printf '%P\n' | while read -r pkg; do