Spaces:
Paused
Paused
icebear0828 Claude Opus 4.6 commited on
Commit ·
20b98cc
1
Parent(s): 8ab512c
ci: trigger release via workflow_dispatch to fix GITHUB_TOKEN limitation
Browse filesGITHUB_TOKEN push events don't trigger downstream workflows. Instead of
relying on tag push to trigger release.yml, sync-electron now explicitly
calls `gh workflow run` with the tag name after pushing.
- release.yml: accept `inputs.tag` for workflow_dispatch, checkout + release by tag
- sync-electron.yml: add `gh workflow run release.yml` step after tag push
- Add `actions: write` permission for workflow dispatch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
.github/workflows/release.yml
CHANGED
|
@@ -5,6 +5,11 @@ on:
|
|
| 5 |
tags:
|
| 6 |
- "v*"
|
| 7 |
workflow_dispatch:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
permissions:
|
| 10 |
contents: write
|
|
@@ -30,6 +35,8 @@ jobs:
|
|
| 30 |
steps:
|
| 31 |
- name: Checkout
|
| 32 |
uses: actions/checkout@v4
|
|
|
|
|
|
|
| 33 |
|
| 34 |
- name: Setup Node.js
|
| 35 |
uses: actions/setup-node@v4
|
|
@@ -72,11 +79,14 @@ jobs:
|
|
| 72 |
release:
|
| 73 |
needs: build
|
| 74 |
runs-on: ubuntu-latest
|
| 75 |
-
if: startsWith(github.ref, 'refs/tags/v')
|
| 76 |
|
| 77 |
steps:
|
| 78 |
- name: Checkout
|
| 79 |
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
- name: Download all artifacts
|
| 82 |
uses: actions/download-artifact@v4
|
|
@@ -84,14 +94,21 @@ jobs:
|
|
| 84 |
path: artifacts
|
| 85 |
merge-multiple: true
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
- name: Generate release notes
|
| 88 |
id: notes
|
| 89 |
run: |
|
| 90 |
-
|
|
|
|
| 91 |
if [ -z "$PREV_TAG" ]; then
|
| 92 |
BODY="Initial release"
|
| 93 |
else
|
| 94 |
-
BODY=$(git log "${PREV_TAG}..
|
| 95 |
| grep -vE "^(chore|docs|ci)(\(.*\))?:" \
|
| 96 |
| sed 's/^/- /')
|
| 97 |
if [ -z "$BODY" ]; then
|
|
@@ -107,6 +124,7 @@ jobs:
|
|
| 107 |
- name: Create GitHub Release
|
| 108 |
uses: softprops/action-gh-release@v2
|
| 109 |
with:
|
|
|
|
| 110 |
body: ${{ steps.notes.outputs.NOTES }}
|
| 111 |
draft: false
|
| 112 |
prerelease: false
|
|
|
|
| 5 |
tags:
|
| 6 |
- "v*"
|
| 7 |
workflow_dispatch:
|
| 8 |
+
inputs:
|
| 9 |
+
tag:
|
| 10 |
+
description: "Tag to release (e.g. v1.0.11)"
|
| 11 |
+
required: true
|
| 12 |
+
type: string
|
| 13 |
|
| 14 |
permissions:
|
| 15 |
contents: write
|
|
|
|
| 35 |
steps:
|
| 36 |
- name: Checkout
|
| 37 |
uses: actions/checkout@v4
|
| 38 |
+
with:
|
| 39 |
+
ref: ${{ inputs.tag || github.ref }}
|
| 40 |
|
| 41 |
- name: Setup Node.js
|
| 42 |
uses: actions/setup-node@v4
|
|
|
|
| 79 |
release:
|
| 80 |
needs: build
|
| 81 |
runs-on: ubuntu-latest
|
| 82 |
+
if: startsWith(github.ref, 'refs/tags/v') || inputs.tag
|
| 83 |
|
| 84 |
steps:
|
| 85 |
- name: Checkout
|
| 86 |
uses: actions/checkout@v4
|
| 87 |
+
with:
|
| 88 |
+
ref: ${{ inputs.tag || github.ref }}
|
| 89 |
+
fetch-depth: 0
|
| 90 |
|
| 91 |
- name: Download all artifacts
|
| 92 |
uses: actions/download-artifact@v4
|
|
|
|
| 94 |
path: artifacts
|
| 95 |
merge-multiple: true
|
| 96 |
|
| 97 |
+
- name: Resolve tag
|
| 98 |
+
id: tag
|
| 99 |
+
run: |
|
| 100 |
+
TAG="${{ inputs.tag || github.ref_name }}"
|
| 101 |
+
echo "name=$TAG" >> "$GITHUB_OUTPUT"
|
| 102 |
+
|
| 103 |
- name: Generate release notes
|
| 104 |
id: notes
|
| 105 |
run: |
|
| 106 |
+
TAG="${{ steps.tag.outputs.name }}"
|
| 107 |
+
PREV_TAG=$(git tag --sort=-v:refname | grep '^v' | grep -v "^${TAG}$" | head -1)
|
| 108 |
if [ -z "$PREV_TAG" ]; then
|
| 109 |
BODY="Initial release"
|
| 110 |
else
|
| 111 |
+
BODY=$(git log "${PREV_TAG}..${TAG}" --no-merges --pretty=format:"%s" \
|
| 112 |
| grep -vE "^(chore|docs|ci)(\(.*\))?:" \
|
| 113 |
| sed 's/^/- /')
|
| 114 |
if [ -z "$BODY" ]; then
|
|
|
|
| 124 |
- name: Create GitHub Release
|
| 125 |
uses: softprops/action-gh-release@v2
|
| 126 |
with:
|
| 127 |
+
tag_name: ${{ steps.tag.outputs.name }}
|
| 128 |
body: ${{ steps.notes.outputs.NOTES }}
|
| 129 |
draft: false
|
| 130 |
prerelease: false
|
.github/workflows/sync-electron.yml
CHANGED
|
@@ -10,6 +10,7 @@ concurrency:
|
|
| 10 |
cancel-in-progress: true
|
| 11 |
|
| 12 |
permissions:
|
|
|
|
| 13 |
contents: write
|
| 14 |
issues: write
|
| 15 |
|
|
@@ -93,6 +94,12 @@ jobs:
|
|
| 93 |
git push origin electron
|
| 94 |
fi
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
- name: Create issue on conflict
|
| 97 |
if: env.CONFLICT == 'true'
|
| 98 |
run: |
|
|
|
|
| 10 |
cancel-in-progress: true
|
| 11 |
|
| 12 |
permissions:
|
| 13 |
+
actions: write
|
| 14 |
contents: write
|
| 15 |
issues: write
|
| 16 |
|
|
|
|
| 94 |
git push origin electron
|
| 95 |
fi
|
| 96 |
|
| 97 |
+
- name: Trigger release workflow
|
| 98 |
+
if: env.BUMP == 'true'
|
| 99 |
+
run: gh workflow run release.yml -f tag="$NEW_TAG" --ref electron
|
| 100 |
+
env:
|
| 101 |
+
GH_TOKEN: ${{ github.token }}
|
| 102 |
+
|
| 103 |
- name: Create issue on conflict
|
| 104 |
if: env.CONFLICT == 'true'
|
| 105 |
run: |
|