Skip to content

Commit 2e7a282

Browse files
committed
release
1 parent 67e1d55 commit 2e7a282

File tree

13 files changed

+252
-9
lines changed

13 files changed

+252
-9
lines changed

.github/workflows/main.yml

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
FILE_NAME: antPathfinding
10+
ICON_NAME: antPathfinding-512
11+
MAIN_CLASS: App
12+
OUT_DIR: out
13+
VERSION: ${{ github.ref_name }}
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
20+
stripped_version: ${{ steps.get_stripped_version.outputs.version }}
21+
22+
steps:
23+
- name: Get stripped version
24+
id: get_stripped_version
25+
run: |
26+
STRIPPED_VERSION=${VERSION#v}
27+
echo "Stripped version: $STRIPPED_VERSION"
28+
echo "::set-output name=version::$STRIPPED_VERSION"
29+
30+
- name: Checkout code
31+
uses: actions/checkout@v3
32+
33+
- name: Extract release notes from changelog
34+
id: changelog_reader
35+
uses: mindsers/changelog-reader-action@v2.2.1
36+
with:
37+
validation_level: warn
38+
version: ${{ env.VERSION }}
39+
path: ./CHANGELOG.md
40+
41+
- name: Compile and Build JAR
42+
run: |
43+
mkdir ${{ env.OUT_DIR }}
44+
javac -d ${{ env.OUT_DIR }} src/*.java
45+
# Generate a temporary manifest file using echo
46+
echo "Main-Class: ${{ env.MAIN_CLASS }}" > customManifest.txt
47+
jar cvfm ${{ env.OUT_DIR }}/${{ env.FILE_NAME }}-${{ env.VERSION }}.jar \
48+
customManifest.txt \
49+
-C ${{ env.OUT_DIR }} ./
50+
51+
- name: Upload JAR as Artifact
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: ${{ env.FILE_NAME }}-jar-${{ env.VERSION }}
55+
path: ${{ env.OUT_DIR }}/${{ env.FILE_NAME }}-${{ env.VERSION }}.jar
56+
57+
- name: Create GitHub Release
58+
id: create_release
59+
uses: actions/create-release@v1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
tag_name: ${{ github.ref }}
64+
release_name: ${{ github.ref_name }}
65+
body: ${{ steps.changelog_reader.outputs.changes }}
66+
67+
- name: Attach JAR to Release
68+
uses: actions/upload-release-asset@v1
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
upload_url: ${{ steps.create_release.outputs.upload_url }}
73+
asset_path: ${{ env.OUT_DIR }}/${{ env.FILE_NAME }}-${{ env.VERSION }}.jar
74+
asset_name: ${{ env.FILE_NAME }}-${{ env.VERSION }}.jar
75+
asset_content_type: application/java-archive
76+
77+
78+
macos_build:
79+
needs: build
80+
runs-on: macOS-latest
81+
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v3
85+
86+
- name: Download JAR from artifact
87+
uses: actions/download-artifact@v3
88+
with:
89+
name: ${{ env.FILE_NAME }}-jar-${{ env.VERSION }}
90+
path: ${{ env.OUT_DIR }}
91+
92+
- name: Create Standalone for MacOS
93+
run: |
94+
jpackage --input ${{ env.OUT_DIR }} \
95+
--name ${{ env.FILE_NAME }} \
96+
--main-jar ${{ env.FILE_NAME }}-${{ env.VERSION }}.jar \
97+
--main-class ${{ env.MAIN_CLASS }} \
98+
--icon assets/icon/${{ env.ICON_NAME }}.icns \
99+
--app-version ${{ needs.build.outputs.stripped_version }} \
100+
--type dmg \
101+
--dest .
102+
103+
104+
- name: List contents of out directory
105+
run: ls ${{ env.OUT_DIR }}
106+
107+
# - name: Rename MacOS standalone
108+
# run: mv ${{ env.FILE_NAME }}-1.0.dmg ${{ env.FILE_NAME }}-MacOS-${{ env.VERSION }}.dmg
109+
110+
- name: Attach MacOS Standalone to Release
111+
uses: actions/upload-release-asset@v1
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
with:
115+
upload_url: ${{ needs.build.outputs.release_upload_url }}
116+
asset_path: ./${{ env.FILE_NAME }}-${{ needs.build.outputs.stripped_version }}.dmg
117+
asset_name: ${{ env.FILE_NAME }}-${{ needs.build.outputs.stripped_version }}-MacOS.dmg
118+
asset_content_type: application/octet-stream
119+
120+
ubuntu_build:
121+
needs: build
122+
runs-on: ubuntu-latest
123+
124+
steps:
125+
- name: Checkout code
126+
uses: actions/checkout@v3
127+
128+
- name: Download JAR from artifact
129+
uses: actions/download-artifact@v3
130+
with:
131+
name: ${{ env.FILE_NAME }}-jar-${{ env.VERSION }}
132+
path: ${{ env.OUT_DIR }}
133+
134+
- name: Create Standalone for Ubuntu
135+
run: |
136+
jpackage --input ${{ env.OUT_DIR }} \
137+
--name ${{ env.FILE_NAME }} \
138+
--main-jar ${{ env.FILE_NAME }}-${{ env.VERSION }}.jar \
139+
--main-class ${{ env.MAIN_CLASS }} \
140+
--icon assets/icon/${{ env.ICON_NAME }}.png \
141+
--resource-dir resources \
142+
--app-version ${{ needs.build.outputs.stripped_version }} \
143+
--type deb \
144+
--dest .
145+
146+
- name: List contents of out directory
147+
run: ls -lh .
148+
149+
# - name: Rename Ubuntu standalone
150+
# run: mv ${{ env.FILE_NAME }}_1.0-1_amd64.deb ${{ env.FILE_NAME }}-Ubuntu-${{ env.VERSION }}_amd64.deb
151+
152+
- name: Attach Ubuntu Standalone to Release
153+
uses: actions/upload-release-asset@v1
154+
env:
155+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156+
with:
157+
upload_url: ${{ needs.build.outputs.release_upload_url }}
158+
asset_path: ./${{ env.FILE_NAME }}_${{ needs.build.outputs.stripped_version }}-1_amd64.deb
159+
asset_name: ${{ env.FILE_NAME }}-${{ env.VERSION }}-linux_amd64.deb
160+
asset_content_type: application/octet-stream
161+
162+
windows_build:
163+
needs: build
164+
runs-on: windows-latest
165+
166+
steps:
167+
- name: Checkout code
168+
uses: actions/checkout@v3
169+
170+
- name: Download JAR from artifact
171+
uses: actions/download-artifact@v3
172+
with:
173+
name: ${{ env.FILE_NAME }}-jar-${{ env.VERSION }}
174+
path: ${{ env.OUT_DIR }}
175+
176+
- name: Setup Java 16
177+
uses: actions/setup-java@v2
178+
with:
179+
java-version: '16'
180+
distribution: 'temurin'
181+
182+
- name: Create Standalone for Windows
183+
run: |
184+
jpackage --input out `
185+
--name ${{ env.FILE_NAME }} `
186+
--main-jar ${{ env.FILE_NAME }}-${{ env.VERSION }}.jar `
187+
--main-class ${{ env.MAIN_CLASS }} `
188+
--icon assets/icon/${{ env.ICON_NAME }}.ico `
189+
--win-shortcut `
190+
--win-menu `
191+
--app-version ${{ needs.build.outputs.stripped_version }} `
192+
--type msi `
193+
--dest .
194+
195+
- name: List contents of out directory (Windows)
196+
run: Get-ChildItem -Path .
197+
198+
# - name: Rename Windows standalone
199+
# run: move ${{ env.FILE_NAME }}-1.0.exe ${{ env.OUT_DIR }}/${{ env.FILE_NAME }}-Windows-${{ env.VERSION }}.exe
200+
201+
- name: Attach Windows Standalone to Release
202+
uses: actions/upload-release-asset@v1
203+
env:
204+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
205+
with:
206+
upload_url: ${{ needs.build.outputs.release_upload_url }}
207+
asset_path: ${{ env.FILE_NAME }}-${{ needs.build.outputs.stripped_version }}.exe
208+
asset_name: ${{ env.FILE_NAME }}-${{ needs.build.outputs.stripped_version }}-windows.exe
209+
asset_content_type: application/octet-stream
210+
211+

.gitignore

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# Compiled class file
22
*.class
33

4-
"java.codeGeneration.generateJavadocCustomTagValueValueValueValueTag": true,
54
# Log file
65
*.log
76

87
# BlueJ files
98
*.ctxt
109

11-
"java.codeGeneration.generateJavadocCustomTagValueValueValueValueDocRoot": true,
1210
# Mobile Tools for Java (J2ME)
1311
.mtj.tmp/
1412

@@ -17,10 +15,24 @@
1715
*.war
1816
*.nar
1917
*.ear
18+
*.zip
19+
*.tar.gz
20+
*.rar
2021

21-
"java.codeGeneration.generateJavadocCustomTagValueValueValueValueInheritDoc": true,
22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22+
# Virtual Machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424

25-
# Visual Studio Code files
26-
.vscode/*
25+
# Visual Studio Code #
26+
.vscode/
27+
*.code-workspace
28+
29+
# OS-specific files
30+
.DS_Store
31+
.DS_Store?
32+
._*
33+
.Spotlight-V100
34+
.Trashes
35+
ehthumbs.db
36+
Thumbs.db
37+
38+
repush.sh

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
## [v1.0.0] - 2023-09-19
8+
9+
### Added
10+
11+
- Initial release.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The game uses a simple state machine to manage the different states of the game.
2929
## Resources
3030

3131
### Images
32+
- [App Icon](https://www.flaticon.com/free-icon/ant_1779584)
3233
- [Ant Image](https://www.pngegg.com/en/png-zblks)
3334
- [Food Image](https://www.pngegg.com/en/png-medpx)
3435

72.7 KB
Binary file not shown.

assets/icon/antPathfinding-512.ico

Whitespace-only changes.

assets/icon/antPathfinding-512.png

27.8 KB
Loading
File renamed without changes.
File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Ant_Path_Finding
4+
Exec=/opt/connect4/bin/antPathfinding
5+
Icon=/opt/connect4/antPathfinding-512.png
6+
Comment=Play Connect4 game
7+
Terminal=false
8+
Categories=Game;

0 commit comments

Comments
 (0)