-
Notifications
You must be signed in to change notification settings - Fork 2
143 lines (123 loc) · 4.48 KB
/
release.yml
File metadata and controls
143 lines (123 loc) · 4.48 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 InterAACtionGaze
on:
workflow_dispatch:
inputs:
bump:
description: 'Version type'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Show version type selected
run: echo "Version selected is -> ${{ github.event.inputs.bump }}"
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: false
haskell: false
large-packages: false
swap-storage: false
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
- name: Download JREs
run: |
chmod +x ./gradlew
./gradlew --stacktrace --info downloadAndExtractJREs
chmod -R 777 build/jre
- name: Setup Git Config
run: |
git config --global user.email "ci@gazeplay.net"
git config --global user.name "GazePlay Automation"
- name: Generate Releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew --stacktrace --info release
- name: Rename Releases
run: |
cd ./build/distributions/
mv interAACtionGaze-linux*.tar.gz interAACtionGaze-linux.tar.gz
mv interAACtionGaze-macos*.tar.gz interAACtionGaze-macos.tar.gz
mv interAACtionGaze-no-jre*.zip interAACtionGaze-noJRE.zip
mv interAACtionGaze-no-jre*.tar.gz interAACtionGaze-noJRE.tar.gz
mv interAACtionGaze-windows*.zip interAACtionGaze-windows.zip
mv interAACtionGaze-windows-x64*installer.exe interAACtionGaze-windows-x64-installer.exe
- name: Get Env
run: |
echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV
echo "REPO_BASENAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV
- name: New tag
id: new-tag
run: |
latest_tag=$(curl -s https://api.github.com/repos/${{ env.REPO_NAME }}/releases/latest | jq -r .tag_name)
version="${latest_tag#v}" # strip leading 'v'
IFS='.' read -r major minor patch <<< "$version"
case "${{ github.event.inputs.bump }}" in
major)
major=$((major + 1))
minor=0
patch=0
nexPatch=$((patch + 1))
;;
minor)
minor=$((minor + 1))
patch=0
nexPatch=$((patch + 1))
;;
patch)
patch=$((patch + 1))
nexPatch=$((patch + 1))
;;
*)
echo "Option invalide: $bump"
exit 1
;;
esac
new_tag="v$major.$minor.$patch"
next_tag="$major.$minor.$nexPatch"
echo "tag=$new_tag" >> $GITHUB_OUTPUT
echo "nextTag=$next_tag" >> $GITHUB_OUTPUT
- name: Update version project for gradle
run: |
version="${{ steps.new-tag.outputs.nextTag }}"
if grep -q '^version=' gradle.properties; then
sed -i "s/^version=.*/version=${version}/" gradle.properties
else
echo "version=${version}" >> gradle.properties
fi
- name: Setup next release
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add gradle.properties
git commit -m "Setup next release for gradle"
git push
- name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.new-tag.outputs.tag }}
name: interAACtionGaze ${{ steps.new-tag.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
commit: "master"
prerelease: true
draft: false
artifacts: "./build/distributions/interAACtionGaze-linux.tar.gz,./build/distributions/interAACtionGaze-macos.tar.gz,./build/distributions/interAACtionGaze-noJRE.tar.gz,./build/distributions/interAACtionGaze-noJRE.zip,./build/distributions/interAACtionGaze-windows.zip,./build/distributions/interAACtionGaze-windows-x64-installer.exe"