2024-01-17 09:40:26 +08:00
|
|
|
name: Java CI-CD with Maven
|
2023-12-05 11:52:24 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-12-07 11:54:48 +08:00
|
|
|
tags:
|
|
|
|
- '*'
|
2023-12-05 11:52:24 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-12-07 11:29:04 +08:00
|
|
|
- name: "Pull & Checkout"
|
|
|
|
uses: https://ssl.lunadeer.cn:14446/actions/checkout@v3
|
2023-12-07 11:09:35 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-12-07 10:57:50 +08:00
|
|
|
- name: "Set up Maven"
|
2023-12-07 11:22:53 +08:00
|
|
|
uses: https://ssl.lunadeer.cn:14446/actions/setup-maven@v4
|
2023-12-07 10:57:50 +08:00
|
|
|
- name: "Set up JDK 17"
|
2023-12-07 11:22:53 +08:00
|
|
|
uses: https://ssl.lunadeer.cn:14446/actions/setup-java@v3
|
2023-12-05 11:52:24 +08:00
|
|
|
with:
|
|
|
|
java-version: '17'
|
2023-12-07 11:29:04 +08:00
|
|
|
distribution: 'zulu'
|
2023-12-05 11:52:24 +08:00
|
|
|
cache: maven
|
2023-12-07 10:57:50 +08:00
|
|
|
- name: "Build with Maven"
|
2023-12-05 11:52:24 +08:00
|
|
|
run: mvn -B package --file pom.xml
|
2023-12-07 11:06:51 +08:00
|
|
|
- name: "Copy jar to staging"
|
|
|
|
run: mkdir staging && cp target/*.jar staging
|
2023-12-05 11:52:24 +08:00
|
|
|
- name: "Build & test"
|
|
|
|
run: |
|
|
|
|
echo "done!"
|
2023-12-07 11:06:51 +08:00
|
|
|
- name: "setup go for release script"
|
2024-01-16 17:33:18 +08:00
|
|
|
run: |
|
2024-01-17 09:19:57 +08:00
|
|
|
wget --no-check-certificate https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
|
2024-01-16 17:33:18 +08:00
|
|
|
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gz
|
2024-01-16 21:03:53 +08:00
|
|
|
ln -s /usr/local/go/bin/go /usr/bin/go
|
2024-01-16 17:33:18 +08:00
|
|
|
go version
|
2023-12-07 10:52:38 +08:00
|
|
|
- name: "Release"
|
2023-12-07 11:22:53 +08:00
|
|
|
uses: https://ssl.lunadeer.cn:14446/actions/release-action@main
|
2023-12-05 11:52:24 +08:00
|
|
|
with:
|
2023-12-07 10:52:38 +08:00
|
|
|
files: |-
|
2023-12-05 11:52:24 +08:00
|
|
|
staging/*.jar
|
2023-12-07 10:52:38 +08:00
|
|
|
api_key: '${{secrets.RELEASE_TOKEN}}'
|