Skip to content

Commit 7625467

Browse files
committed
another attempt at fixing the CI
1 parent fce744a commit 7625467

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Release
22

33
on:
4+
repository_dispatch:
5+
types: [trigger-release]
46
workflow_dispatch:
57
push:
68
tags:
@@ -27,9 +29,18 @@ jobs:
2729
- name: Package build output
2830
run: npm pack
2931

32+
- name: Set TAG from repository_dispatch
33+
if: github.event_name == 'repository_dispatch'
34+
run: echo "TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
35+
36+
- name: Set TAG from push
37+
if: github.event_name == 'push'
38+
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
39+
3040
- name: Create GitHub Release
3141
uses: softprops/action-gh-release@v2
3242
with:
43+
tag_name: ${{ env.TAG }}
3344
files: '*.tgz'
3445
env:
3546
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tag-version.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,21 @@ jobs:
1818
fetch-depth: 0 # fetch all tags
1919

2020
- name: Tag and push if new version
21-
env:
22-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2321
run: |
2422
VERSION=$(jq -r .version package.json)
2523
TAG="v$VERSION"
2624
if git rev-parse "$TAG" >/dev/null 2>&1; then
2725
echo "Tag $TAG already exists. No action taken."
2826
else
29-
gh auth login --with-token < <(echo "$GH_TOKEN")
30-
gh api repos/${GITHUB_REPOSITORY}/git/refs -f ref="refs/tags/$TAG" -f sha="$(git rev-parse HEAD)"
31-
echo "Tag $TAG created via GitHub API."
27+
git config user.name "github-actions[bot]"
28+
git config user.email "github-actions[bot]@users.noreply.github.com"
29+
git tag "$TAG"
30+
git push origin "$TAG"
31+
echo "Tag $TAG created and pushed."
32+
33+
curl -X POST \
34+
-H "Authorization: token $GITHUB_TOKEN" \
35+
-H "Accept: application/vnd.github.v3+json" \
36+
https://api.github.com/repos/$GITHUB_REPOSITORY/dispatches \
37+
-d "{\"event_type\":\"trigger-release\",\"client_payload\":{\"tag\":\"$TAG\"}}"
3238
fi

0 commit comments

Comments
 (0)