-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (112 loc) · 4.37 KB
/
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
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
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build: windows
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
shell: bash
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
version=${GITHUB_REF#refs/tags/}
sed -i "s/\t\t<Version>[0-9\.]*<\/Version>/\t\t<Version>$version<\/Version>/" ./plugin/plugin/Aetherment.csproj
sed -i "0,/version = \"[0-9\.]*\"/s//version = \"$version\"/" ./plugin/Cargo.toml
sed -i "0,/version = \"[0-9\.]*\"/s//version = \"$version\"/" ./client/Cargo.toml
- name: Commit Version
shell: bash
if: matrix.os == 'ubuntu-latest'
run: |
git config --global user.name "Actions User"
git config --global user.email "[email protected]"
git fetch origin master
git branch -f master ${{ github.sha }}
git checkout master
git add ./plugin/plugin/Aetherment.csproj
git add ./plugin/Cargo.toml
git add ./client/Cargo.toml
git commit -m "[CI] Update version to ${{ env.VERSION }}"
git push origin master
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install .NET
uses: actions/setup-dotnet@v1
if: matrix.target == 'x86_64-pc-windows-msvc'
with:
dotnet-version: '8.x.x'
- name: Download Dalamud
shell: bash
if: matrix.target == 'x86_64-pc-windows-msvc'
run: |
curl https://goatcorp.github.io/dalamud-distrib/stg/latest.zip --output dalamud.zip
# mkdir -p "$HOME/.xlcore/dalamud/Hooks/dev"
# unzip dalamud.zip -d "$HOME/.xlcore/dalamud/Hooks/dev"
mkdir -p "$APPDATA/XIVLauncher/addon/Hooks/dev"
7z x dalamud.zip -o"$APPDATA/XIVLauncher/addon/Hooks/dev"
- name: Build Plugin
shell: bash
if: matrix.target == 'x86_64-pc-windows-msvc'
run: |
dotnet build ./plugin/plugin/Aetherment.csproj -c Release
cargo build --lib --release --target x86_64-pc-windows-msvc --manifest-path=./plugin/Cargo.toml
- name: Archive Plugin
shell: bash
if: matrix.target == 'x86_64-pc-windows-msvc'
run: |
dirname="aetherment-${{ env.VERSION }}-plugin"
mkdir "$dirname"
releasedir="./target/x86_64-pc-windows-msvc/release"
# zip $dirname.zip "$releasedir/Aetherment.json" "$releasedir/Aetherment.dll" "$releasedir/aetherment_core.dll"
7z a $dirname.zip "$releasedir/Aetherment.json" "$releasedir/Aetherment.dll" "$releasedir/aetherment_core.dll"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
- name: Release Plugin
uses: softprops/action-gh-release@v1
if: matrix.target == 'x86_64-pc-windows-msvc'
with:
files: |
${{ env.ASSET }}
- name: Build Client
shell: bash
run: |
cargo build --release --target ${{ matrix.target }} --manifest-path=./client/Cargo.toml
- name: Archive Client
shell: bash
run: |
dirname="aetherment-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/client.exe" "$dirname/aetherment.exe"
else
mv "target/${{ matrix.target }}/release/client" "$dirname/aetherment"
fi
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Release Client
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.ASSET }}