Skip to content

Commit

Permalink
Main 브랜치에 푸쉬시 jar 파일 생성 workflow 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
namsh1125 committed Feb 11, 2025
1 parent 28a235b commit 8788626
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Upload JAR

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"

- name: Create result directory
run: mkdir -p result

- name: Compile Java files
run: |
mkdir -p build
javac -d build src/*.java
- name: Create JAR file
run: |
cd build
jar cvfe ../result/stock-trading.jar Main *.class
cd ..
- name: Push JAR file
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MY_GITHUB_TOKEN }}
branch: ${{ github.ref }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.idea/
out/
bin/
bin/
/build/
*.class
!result/*.jar

0 comments on commit 8788626

Please sign in to comment.