forked from skyrim-multiplayer/skymp
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (75 loc) · 3.77 KB
/
sp-release.yml
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: SP Release
on:
workflow_dispatch:
jobs:
sprelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Versions
run: |
OLDVER=$(sed -n "s/.*\([0-9]\.[0-9]\.[0-9]*\).*/\1/p" ${{github.workspace}}/skyrim-platform/package.json | head -1)
MINOR=$(echo "$OLDVER" | sed -n "s/[0-9]\.\([0-9]\)\.[0-9]/\1/p")
NEWMINOR=$((MINOR+1))
NEWVER=$(echo "$OLDVER" | sed -n "s/\.$MINOR\./\.$NEWMINOR\./p")
SHORTVER=$(echo "$NEWVER" | sed -r "s/\.0//g")
echo "OLDVER=$OLDVER" >> $GITHUB_ENV
echo "NEWVER=$NEWVER" >> $GITHUB_ENV
echo "SHORTVER=$SHORTVER" >> $GITHUB_ENV
echo "Detect oldver: $OLDVER"
echo "Newver: $NEWVER"
- name: Replace Version In Files
run: |
chmod 777 ${{github.workspace}}/skyrim-platform/src/platform_se/CMakeLists.txt
chmod 777 ${{github.workspace}}/skyrim-platform/src/platform_se/skyrim_platform/DevApi.cpp
chmod 777 ${{github.workspace}}/skyrim-platform/package.json
chmod 777 ${{github.workspace}}/skyrim-platform/tools/plugin-example/package.json
chmod 777 ${{github.workspace}}/skymp5-client/src/version.ts
sed -i "s/${{ env.OLDVER }}/${{ env.NEWVER }}/g" ${{github.workspace}}/skyrim-platform/src/platform_se/CMakeLists.txt
sed -i "s/${{ env.OLDVER }}/${{ env.NEWVER }}/g" ${{github.workspace}}/skyrim-platform/src/platform_se/skyrim_platform/DevApi.cpp
sed -i "s/${{ env.OLDVER }}/${{ env.NEWVER }}/g" ${{github.workspace}}/skyrim-platform/package.json
sed -i "s/${{ env.OLDVER }}/${{ env.NEWVER }}/g" ${{github.workspace}}/skyrim-platform/tools/plugin-example/package.json
sed -i "s/${{ env.OLDVER }}/${{ env.NEWVER }}/g" ${{github.workspace}}/skymp5-client/src/version.ts
chmod 644 ${{github.workspace}}/skyrim-platform/src/platform_se/CMakeLists.txt
chmod 644 ${{github.workspace}}/skyrim-platform/src/platform_se/skyrim_platform/DevApi.cpp
chmod 644 ${{github.workspace}}/skyrim-platform/package.json
chmod 644 ${{github.workspace}}/skyrim-platform/tools/plugin-example/package.json
chmod 644 ${{github.workspace}}/skymp5-client/src/version.ts
- name: Generate Changelog
run: |
chmod 777 ${{github.workspace}}/docs/release
TRAGET=$(echo "${{github.workspace}}/docs/release/sp-${{ env.SHORTVER }}.md")
cp ${{github.workspace}}/docs/release/changelog_template.md $TRAGET
sed -i "s/{{NEWVER}}/${{ env.NEWVER }}/g" $TRAGET
sed -i "s/{{OLDVER}}/${{ env.OLDVER }}/g" $TRAGET
for file in `find ${{github.workspace}}/docs/release/dev -type f -name "sp*.md"`
do
content=$(< $file)
if grep -q "^#" "$file"; then
echo "$content" >> $TRAGET
echo $'\n' >> $TRAGET
else
echo "- $content" >> ./temp.txt
echo $'\n' >> ./temp.txt
fi
done
if [ -e temp.txt ]; then
echo "## Other changes"$'\n' >> $TRAGET
content=$(< ./temp.txt)
echo "$content" >> $TRAGET
echo $'\n' >> ./temp.txt
rm -f ./temp.txt
fi
- name: Remove files used in changelog
run: |
for file in `find ${{github.workspace}}/docs/release/dev -type f -name "sp*.md"`
do
rm $file
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: "release(skyrim-platform): version ${{ env.SHORTVER }}"
title: "release(skyrim-platform): version ${{ env.SHORTVER }}"
body: Bot put here this release PR, enjoy...
branch: "release-sp${{ env.SHORTVER }}"