Skip to content

Commit fddfedb

Browse files
authored
Merge pull request #2 from gxtm/copilot/fix-workflow-to-generate-jar
[WIP] Fix workflow to generate jar file and push to release
2 parents 775b86a + 7a280fe commit fddfedb

File tree

5 files changed

+124
-3
lines changed

5 files changed

+124
-3
lines changed

.github/workflows/maven.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v3
19-
- name: Set up JDK 11
19+
- name: Set up JDK 17
2020
uses: actions/setup-java@v3
2121
with:
22-
java-version: '11'
22+
java-version: '17'
2323
distribution: 'temurin'
2424
cache: maven
2525
- name: Build with Maven
2626
run: mvn -B package --file pom.xml
27+
- name: Upload JAR as artifact
28+
uses: actions/upload-artifact@v3
29+
with:
30+
name: TodoApp-jar
31+
path: target/*.jar
2732
- name: Cache
2833
uses: actions/[email protected]
2934
with:

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
cache: maven
23+
24+
- name: Build with Maven
25+
run: mvn -B package --file pom.xml
26+
27+
- name: Create Release
28+
uses: softprops/action-gh-release@v1
29+
with:
30+
files: target/*.jar
31+
generate_release_notes: true
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Maven build artifacts
2+
target/
3+
4+
# IDE files
5+
.idea/
6+
*.iml
7+
8+
# OS files
9+
.DS_Store
10+
Thumbs.db

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
# TodoApp
22

33
## Description
4-
A command-line todo app that just happened one afternoon. It seemed like a good idea at the time.
4+
A command-line todo app that just happened one afternoon. It seemed like a good idea at the time.
5+
6+
## Download
7+
You can download the latest release from the [Releases page](https://github.com/gxtm/FileHandler/releases).
8+
9+
## Running the Application
10+
```bash
11+
java -jar TodoApp-1.0-SNAPSHOT.jar
12+
```
13+
14+
## Available Commands
15+
- `add` - Add a new TODO item
16+
- `list` - List all TODO items
17+
- `delete` or `remove` - Delete a TODO item
18+
- `help` - Show help information
19+
20+
## Building from Source
21+
This project uses Maven. To build:
22+
```bash
23+
mvn clean package
24+
```
25+
26+
The JAR file will be created in the `target/` directory.
27+
28+
## Release Process
29+
See [RELEASE.md](RELEASE.md) for information about creating releases.

RELEASE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Release Process
2+
3+
This project has two GitHub Actions workflows for building and releasing the TodoApp JAR file.
4+
5+
## CI Workflow (maven.yml)
6+
7+
Runs on every push to `main` branch and on pull requests:
8+
- Builds the project with Maven
9+
- Uploads the JAR file as a workflow artifact
10+
- Artifacts are available for download from the Actions tab
11+
12+
## Release Workflow (release.yml)
13+
14+
Triggers when a version tag is pushed (tags starting with `v`, e.g., `v1.0.0`, `v2.1.3`):
15+
- Builds the project with Maven
16+
- Creates a GitHub Release
17+
- Attaches the JAR file to the release
18+
- Generates release notes automatically
19+
20+
### Creating a Release
21+
22+
To create a new release:
23+
24+
1. Tag your commit with a version number:
25+
```bash
26+
git tag v1.0.0
27+
git push origin v1.0.0
28+
```
29+
30+
2. The workflow will automatically:
31+
- Build the JAR file
32+
- Create a GitHub Release with the tag
33+
- Upload the JAR to the release
34+
35+
3. The release will be visible at: `https://github.com/gxtm/FileHandler/releases`
36+
37+
### JAR File Details
38+
39+
- **Artifact Name**: `TodoApp-1.0-SNAPSHOT.jar`
40+
- **Main Class**: `me.gixu.Main`
41+
- **Java Version**: 17
42+
43+
### Running the JAR
44+
45+
After downloading the JAR from a release, run it with:
46+
```bash
47+
java -jar TodoApp-1.0-SNAPSHOT.jar
48+
```

0 commit comments

Comments
 (0)