|
10 | 10 | description: 'Version tag (e.g., v1.0.0)' |
11 | 11 | required: true |
12 | 12 | type: string |
| 13 | + branch: |
| 14 | + description: 'Branch to build from (default: main)' |
| 15 | + required: false |
| 16 | + type: string |
| 17 | + default: 'main' |
| 18 | + commit_id: |
| 19 | + description: 'Specific commit SHA to build (overrides branch if set)' |
| 20 | + required: false |
| 21 | + type: string |
13 | 22 | compare_from: |
14 | 23 | description: 'Compare from tag (optional, auto-detects if empty)' |
15 | 24 | required: false |
|
41 | 50 | - name: Checkout code |
42 | 51 | uses: actions/checkout@v4 |
43 | 52 | with: |
| 53 | + ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }} |
44 | 54 | fetch-depth: 0 |
45 | 55 |
|
46 | 56 | - name: Get version |
@@ -72,13 +82,19 @@ jobs: |
72 | 82 | git config --local user.name "GitHub Action" |
73 | 83 |
|
74 | 84 | VERSION=${{ steps.version.outputs.version }} |
| 85 | + COMMIT_REF="${{ github.event.inputs.commit_id }}" |
| 86 | + if [ -z "$COMMIT_REF" ]; then |
| 87 | + COMMIT_REF="HEAD" |
| 88 | + fi |
| 89 | + echo "Tagging commit: $COMMIT_REF" |
| 90 | +
|
75 | 91 | if git tag --list | grep -q "^${VERSION}$"; then |
76 | 92 | echo "Tag $VERSION already exists, deleting it first" |
77 | 93 | git tag -d $VERSION || true |
78 | 94 | git push --delete origin $VERSION || true |
79 | 95 | fi |
80 | 96 |
|
81 | | - git tag -a $VERSION -m "Release $VERSION" |
| 97 | + git tag -a $VERSION $COMMIT_REF -m "Release $VERSION" |
82 | 98 | git push origin $VERSION |
83 | 99 |
|
84 | 100 | - name: Build static binary via Docker |
@@ -127,6 +143,7 @@ jobs: |
127 | 143 | - name: Checkout code |
128 | 144 | uses: actions/checkout@v4 |
129 | 145 | with: |
| 146 | + ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }} |
130 | 147 | fetch-depth: 0 |
131 | 148 |
|
132 | 149 | - name: Get version |
@@ -199,6 +216,7 @@ jobs: |
199 | 216 | - name: Checkout code |
200 | 217 | uses: actions/checkout@v4 |
201 | 218 | with: |
| 219 | + ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }} |
202 | 220 | fetch-depth: 0 |
203 | 221 |
|
204 | 222 | - name: Get version |
@@ -396,6 +414,7 @@ jobs: |
396 | 414 | - name: Checkout code |
397 | 415 | uses: actions/checkout@v4 |
398 | 416 | with: |
| 417 | + ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }} |
399 | 418 | fetch-depth: 0 |
400 | 419 |
|
401 | 420 | - name: Get version |
|
0 commit comments