-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (82 loc) · 3.13 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
name: Release Server
on:
push:
branches: ["main"]
workflow_dispatch:
env:
url: https://kotlingames.shop
permissions:
contents: read
pages: write
id-token: write
jobs:
release:
permissions: write-all
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: set properties value of server
run: |
setProperty(){
awk -v pat="^$1=" -v value="$1=$2" '{ if ($0 ~ pat) print value; else print $0; }' $3 > $3.tmp
mv $3.tmp $3
}
setProperty "server" "${{ env.url }}" "gradle.properties"
setProperty "version" "v0.0.${{github.run_number}}" "gradle.properties"
- run: git tag ${{github.run_number}}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Buid JS bundle
run: |
./gradlew :client:jsBrowserProductionWebpack
- name: server.zip
run: ./gradlew :server:distZip
- name: release
uses: marvinpinto/action-automatic-releases@latest
with:
title: "Build #${{github.run_number}}"
automatic_release_tag: "${{github.run_number}}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: server/build/distributions/server.zip
prerelease: false
- shell: bash
run: |
curl -d "${{ secrets.ADMIN_KEY }}" -X POST ${{ env.url }}/shutdown
buildExe:
name: Release .exe
runs-on: windows-latest
needs: release
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: set properties value of server
run: |
type nul > Prop.java
echo "import java.io.File;import java.io.FileInputStream;import java.util.Arrays;import java.util.Iterator;import java.util.Properties;public class Prop {public static void main(String[] args) throws Exception {Iterator<String> iterator = Arrays.stream(args).iterator();if (!iterator.hasNext()) return;String fileName = iterator.next();File file = new File(fileName);Properties props = new Properties();props.load(new FileInputStream(file));while (true) {if (!iterator.hasNext()) return;String key = iterator.next();if (!iterator.hasNext()) return;String value = iterator.next();props.setProperty(key, value);}}}" > Prop.java
java Prop.java gradle.properties server ${{ env.url }}
java Prop.java gradle.properties version v0.0.${{github.run_number}}
- run: git tag ${{github.run_number}}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Buid JS bundle
run: |
./gradlew :client:linkReleaseExecutableMingwX64
- name: Build
run: cargo build --release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: client/build
tag: ${{ github.ref }}
overwrite: true