Skip to content

Commit 6eee578

Browse files
committed
ソースをmavenにアップロードするように
1 parent 4834bc7 commit 6eee578

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths-ignore:
7+
- "**.md"
8+
- "renovate.json"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Cache Maven packages # ←この行追加
18+
uses: actions/cache@v4
19+
with:
20+
path: |
21+
~/.m2/repository
22+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
23+
restore-keys: |
24+
${{ runner.os }}-maven-
25+
- name: Set up JDK 16
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '16'
29+
distribution: 'corretto'
30+
server-id: azisaba
31+
- name: Build with Maven
32+
run: mvn -B package --file pom.xml
33+
- name: Prepare settings.xml
34+
run: |
35+
echo "<settings><servers><server><id>azisaba</id><username>${{ secrets.REPO_USERNAME }}</username><password>${{ secrets.REPO_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
36+
- name: Deploy
37+
run: mvn deploy

.github/workflows/released.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
9+
jobs:
10+
# ビルドとリリースまでの処理
11+
build-release:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Cache Maven packages # ←この行追加
20+
uses: actions/cache@v4
21+
with:
22+
path: |
23+
~/.m2/repository
24+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25+
restore-keys: |
26+
${{ runner.os }}-maven-
27+
28+
- name: Setup JDK #JDKセットアップ
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: 'corretto'
32+
java-version: '16'
33+
34+
- name: Build with Maven
35+
run: mvn -B package --file pom.xml
36+
37+
- name: Collect Releases #リリースしたものを収集
38+
run: |
39+
mkdir release
40+
cp target/*.jar release/
41+
42+
43+
- name: Upload Artifact #アーティファクトをアップロード
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: releases
47+
path: release/*
48+
49+
- name: ${{ github.ref_name }}リリース #GiHubにリリース
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
files: release/*

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,15 @@
117117
<version>3.7.2</version>
118118
</dependency>
119119
</dependencies>
120+
121+
<distributionManagement>
122+
<repository>
123+
<id>azisaba</id>
124+
<url>https://repo.azisaba.net/repository/maven-releases/</url>
125+
</repository>
126+
<snapshotRepository>
127+
<id>azisaba</id>
128+
<url>https://repo.azisaba.net/repository/maven-snapshots/</url>
129+
</snapshotRepository>
130+
</distributionManagement>
120131
</project>

0 commit comments

Comments
 (0)