-
Notifications
You must be signed in to change notification settings - Fork 45
61 lines (53 loc) · 1.91 KB
/
Copy pathmain.yml
File metadata and controls
61 lines (53 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# .github/workflows/main.yml (Go)
name: Release Go SDK
on:
push:
branches: [master]
paths:
- '.changelog/v*.md'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
with:
go-version: '1.21'
- name: Extract Version
id: version
run: |
VERSION=$(grep -oP 'const SDKVersion = "\K[^"]+' volcengine/version.go 2>/dev/null || cat VERSION)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Create Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a ${{ steps.version.outputs.tag }} -m "Release ${{ steps.version.outputs.tag }}"
git push origin ${{ steps.version.outputs.tag }}
- name: Read Changelog
id: changelog
run: |
CHANGELOG_FILE=".changelog/${{ steps.version.outputs.tag }}.md"
if [ -f "$CHANGELOG_FILE" ]; then
delimiter="$(openssl rand -hex 8)"
echo "content<<$delimiter" >> $GITHUB_OUTPUT
cat "$CHANGELOG_FILE" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT
else
echo "content=Release ${{ steps.version.outputs.tag }}" >> $GITHUB_OUTPUT
fi
- name: Create Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Release ${{ steps.version.outputs.tag }}
body: ${{ steps.changelog.outputs.content }}