-
Notifications
You must be signed in to change notification settings - Fork 5
83 lines (71 loc) · 2.6 KB
/
release.yml
File metadata and controls
83 lines (71 loc) · 2.6 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release
on:
push:
branches:
- main
paths:
- 'src/version.h'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Get Last Tag
run: |
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "0.0.0")
echo "LAST_TAG=$LAST_TAG" >> $GITHUB_ENV
- name: Get Version from version.h
run: |
MAJOR=$(grep '#define RELEASE_VER_MAIN' src/version.h | awk '{print $3}')
MINOR=$(grep '#define RELEASE_VER_SUB' src/version.h | awk '{print $3}')
PATCH=$(grep '#define RELEASE_VER_FIX' src/version.h | awk '{print $3}')
VERSION="$MAJOR.$MINOR.$PATCH"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${{ env.VERSION }}" -m "${{ env.VERSION }}"
- name: Generate Release Notes
run: |
chmod +x .github/workflows/genReleaseNote.sh
.github/workflows/genReleaseNote.sh -v ${{ env.LAST_TAG }}...${{ env.VERSION }}
- name: Get Latest Workflow Run
id: workflow
run: |
RUN_ID=$(gh api repos/${{ github.repository }}/actions/workflows/build.yml/runs \
--jq '.workflow_runs[0].id')
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
path: build_artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ steps.workflow.outputs.run_id }}
- name: Prepare Release Files
run: |
for arch in x86 x64 arm64; do
mv build_artifacts/setdll-$arch/setdll.exe build_artifacts/setdll-$arch.exe
rm -rf build_artifacts/setdll-$arch
done
cp injectpe.bat build_artifacts/
cp README.md build_artifacts/
- name: Create Archive
run: |
cd build_artifacts
7z a -mx=9 -ms=on -m0=lzma2 -mmt=on setdll-${{ env.VERSION }}.7z *
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
body_path: release.md
files: build_artifacts/setdll-${{ env.VERSION }}.7z
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}