-
Notifications
You must be signed in to change notification settings - Fork 123
151 lines (127 loc) · 4.8 KB
/
create-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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release Type'
required: true
type: choice
default: "Alpha"
options:
- "Production"
- "Alpha"
version_override:
description: 'Version Override'
required: false
type: text
default: ""
jobs:
release:
environment: deploy
runs-on: ubuntu-latest
env:
INSTALL4J_DIR: "install4j/install4j10.0.3"
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17.0.1
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17.0.1
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run Checks
run: xvfb-run --auto-servernum ./gradlew --stacktrace -PjavafxPlatform=linux check
env:
JAVA_TOOL_OPTIONS: "-Dprism.verbose=true -Dprism.order=sw"
- name: Set Version
id: set_version
run: |
tagPrefix=$(date +%Y.%-m)
count=0
baseTag=$tagPrefix.$count
git fetch --tags
while [[ $(git tag -l "v$baseTag") ]]
do
count=$(($count+1));
baseTag=$tagPrefix.$count;
done
if [[ "${{ github.event.inputs.release_type }}" == "Alpha" ]]; then
baseTag=$baseTag-alpha
elif [[ "${{ github.event.inputs.release_type }}" == "Experimental" ]]; then
baseTag=$baseTag-experimental
fi
if [[ "${{ github.event.inputs.release_type }}" != "Production" ]]; then
count=1
tag=$baseTag-$count
while [[ $(git tag -l "v$tag") ]]
do
count=$(($count+1));
tag=$baseTag-$count;
done
else
tag=$baseTag
fi
if [[ "${{ github.event.inputs.version_override }}" != "" ]]; then
tag=${{ github.event.inputs.version_override }}
fi
echo ::set-output name=tag::$tag
- name: Download Install4j
run: |
mkdir -p "$HOME/install4j"
curl https://content.faforever.com/build/install4j_unix_10_0_3.tar.gz -o "$HOME/install4j/install4j.tar.gz"
tar xzf "$HOME/install4j/install4j.tar.gz" -C "$HOME/install4j"
- name: Download Bundled JRE
run: |
mkdir -p "$HOME/.local/share/install4j/v9/jres"
curl https://content.faforever.com/build/jre/windows-amd64-17.0.1.tar.gz -o "$HOME/.local/share/install4j/v9/jres/windows-amd64-17.0.1.tar.gz"
- name: Build Windows Files
run: |
./gradlew -Pversion="${{ steps.set_version.outputs.tag }}" \
-PjavafxPlatform=win \
-Pinstall4jHomeDir=$HOME/$INSTALL4J_DIR \
-Pinstall4jLicense=${{ secrets.INSTALL4J_LICENSE }} \
--info \
--stacktrace \
buildInstall4jMediaFiles
- name: Build Linux Files
run: |
./gradlew -Pversion="${{ steps.set_version.outputs.tag }}" \
-PjavafxPlatform=linux \
-Pinstall4jHomeDir=$HOME/$INSTALL4J_DIR \
-Pinstall4jLicense=${{ secrets.INSTALL4J_LICENSE }} \
--info \
--stacktrace \
buildInstall4jMediaFiles
- name: Get Artifact Paths
id: artifact_paths
run: |
WINDOWS_EXE=$(ls build/install4j/faf_windows-x64_*.exe | head -n 1)
WINDOWS_EXE_NAME=$(basename $WINDOWS_EXE)
echo ::set-output name=WINDOWS_EXE::${WINDOWS_EXE}
echo ::set-output name=WINDOWS_EXE_NAME::${WINDOWS_EXE_NAME}
- name: Create Draft Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit: ${{ github.sha }}
tag: v${{ steps.set_version.outputs.tag }}
draft: true
prerelease: ${{ github.event.inputs.release_type != 'Production'}}
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: build/install4j/faf_*
- name: Upload to Mirror
if: github.event.inputs.release_type == 'Production'
uses: bayssmekanique/action-simple-file-upload@v1
with:
user: ${{ secrets.FTP_MIRROR_USERNAME }}
password: ${{ secrets.FTP_MIRROR_PASSWORD }}
host: ${{ secrets.FTP_MIRROR_HOST }}
src: ${{ steps.artifact_paths.outputs.WINDOWS_EXE }}
dest: ${{ steps.artifact_paths.outputs.WINDOWS_EXE_NAME }}