-
Notifications
You must be signed in to change notification settings - Fork 149
143 lines (130 loc) · 5.25 KB
/
release.yml
File metadata and controls
143 lines (130 loc) · 5.25 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Release
on:
push:
branches:
- main
paths:
- 'src/version.h'
workflow_dispatch:
inputs:
run_id:
description: 'Build workflow run ID (for re-running a failed release)'
required: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
artifact-metadata: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
- 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}')
PRE_SUFFIX=$(grep '#define RELEASE_VER_PRE_SUFFIX' src/version.h | awk '{print $3}' | tr -d '"')
VERSION="$MAJOR.$MINOR.$PATCH$PRE_SUFFIX"
echo "VERSION=$VERSION" >> $GITHUB_ENV
if [ -n "$PRE_SUFFIX" ]; then
echo "IS_PRERELEASE=true" >> $GITHUB_ENV
else
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
fi
- name: Get Last Tag
run: |
if [ "${{ env.IS_PRERELEASE }}" = "true" ]; then
LAST_TAG=$(git tag --sort=-version:refname | head -n 1)
else
LAST_TAG=$(git tag --sort=-version:refname | grep -v -- '-' | head -n 1)
fi
if [ -z "$LAST_TAG" ]; then LAST_TAG="0.0.0"; fi
echo "LAST_TAG=$LAST_TAG" >> $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 -f -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 Build Run ID
id: workflow
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
RUN_ID="${{ github.event.inputs.run_id }}"
else
RUN_ID=$(git log -1 --pretty=format:%b | grep -oP '(?<=Build-Run-Id: )\d+')
fi
if [ -z "$RUN_ID" ]; then
echo "Could not determine build run ID." >&2
exit 1
fi
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
- name: Get SetDll Latest Release
id: setdll
run: |
RELEASE_INFO=$(gh api repos/Bush2021/setdll/releases/latest)
DOWNLOAD_URL=$(echo "$RELEASE_INFO" | jq -r '.assets[0].browser_download_url')
echo "download_url=$DOWNLOAD_URL" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Build Artifacts
uses: actions/download-artifact@v7
with:
path: build_artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ steps.workflow.outputs.run_id }}
- name: Package All Artifacts
run: |
mkdir -p artifacts/x86/{App,Data,Cache}
mkdir -p artifacts/x64/{App,Data,Cache}
mkdir -p artifacts/arm64/{App,Data,Cache}
cp -r build_artifacts/version-x86-${{ env.VERSION }}/* artifacts/x86/App/
cp -r build_artifacts/version-x64-${{ env.VERSION }}/* artifacts/x64/App/
cp -r build_artifacts/version-arm64-${{ env.VERSION }}/* artifacts/arm64/App/
cp src/chrome++.ini artifacts/x86/App/
cp src/chrome++.ini artifacts/x64/App/
cp src/chrome++.ini artifacts/arm64/App/
cd artifacts
7z a -mx=9 -m0=lzma2 -mmt=on ../Chrome++_v${{ env.VERSION }}_x86_x64_arm64.7z *
cd ..
- name: Package SetDll
run: |
mkdir -p setdll_package_contents
wget -O setdll_latest.7z ${{ steps.setdll.outputs.download_url }}
7z x setdll_latest.7z -o./setdll_package_contents
rm setdll_latest.7z
cp ./build_artifacts/version-x86-${{ env.VERSION }}/version.dll ./setdll_package_contents/version-x86.dll
cp ./build_artifacts/version-x64-${{ env.VERSION }}/version.dll ./setdll_package_contents/version-x64.dll
cp ./build_artifacts/version-arm64-${{ env.VERSION }}/version.dll ./setdll_package_contents/version-arm64.dll
cp ./src/chrome++.ini ./setdll_package_contents/chrome++.ini
cd setdll_package_contents
echo "Contents of 'setdll_package_contents' directory before zipping:"
ls -Al
7z a -mx=9 -ms=on -m0=lzma2 -mmt=on ../setdll.7z *
cd ..
- name: Attest Release Packages
uses: actions/attest-build-provenance@v3
with:
subject-path: |
Chrome++_v${{ env.VERSION }}_x86_x64_arm64.7z
setdll.7z
- name: Create Release
uses: softprops/action-gh-release@v2.5.0
with:
files: |
Chrome++_v${{ env.VERSION }}_x86_x64_arm64.7z
setdll.7z
body_path: release.md
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
prerelease: ${{ env.IS_PRERELEASE }}
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}