Skip to content

Commit 2e3c268

Browse files
authored
ci: upload to releases
1 parent 1aaa62b commit 2e3c268

File tree

1 file changed

+35
-39
lines changed

1 file changed

+35
-39
lines changed

.github/workflows/main.yml

+35-39
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
11
name: Build and Deploy WAR
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+'
7+
88
jobs:
99
build:
10-
runs-on: ubuntu-latest
11-
12-
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v2
15-
16-
- name: Set up JDK 14
17-
uses: actions/setup=java@v1
18-
with:
19-
java-version: 14
20-
21-
- name: Build WAR
22-
run: jar cvf helloworld.war WEB-INF
23-
24-
- name: Display WAR file
25-
run: ls helloworld.war
26-
27-
- name: Deploy WAR
28-
run: |
29-
mkdir -p deployment
30-
cp helloworld.war deployment/
31-
32-
- name: Store WAR files in repo
33-
run: |
34-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
35-
git config --global user.name "github-actions[bot]"
36-
mkdir -p war
37-
cp helloworld.war war/
38-
git add war
39-
git commit -m "Add WAR file"
40-
git push origin master
41-
42-
43-
44-
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up JDK 14
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: 'temurin'
19+
java-version: '21'
20+
21+
- name: Build WAR
22+
run: jar cvf helloworld.war WEB-INF
23+
24+
- name: Display WAR file
25+
run: ls helloworld.war
26+
27+
- name: Deploy WAR
28+
run: |
29+
mkdir -p deployment
30+
cp helloworld.war deployment/
31+
32+
- name: Upload binaries to release
33+
uses: svenstaro/upload-release-action@v2
34+
with:
35+
repo_token: ${{ secrets.GITHUB_TOKEN }}
36+
file: helloworld.war
37+
asset_name: helloworld.war
38+
tag: ${{ github.ref }}
39+
overwrite: true
40+
body: "HAve fun :)"

0 commit comments

Comments
 (0)