-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (91 loc) · 2.88 KB
/
Build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
push:
# branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
- name: Build with Maven
run: |
mvn versions:set "-DnewVersion=${{ env.GitVersion_SemVer }}"
mvn -B package -e --file pom.xml
- name: Check status
run: |
set
echo -n "Current directory: "
pwd
find
- uses: actions/upload-artifact@v4
with:
name: OoliteAddonScanner
path: target/OoliteAddonScanner-${{ env.GitVersion_SemVer }}-executable.zip
- name: Remove old prereleases
if: github.ref != 'refs/heads/main'
uses: s00d/[email protected]
with:
#repo: <owner>/<repoName> # defaults to current repo
keep_latest: 3
delete_tag_pattern: v
delete_type: 'prerelease'
delete_branch: '${{ github.ref_name }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Prerelease
if: github.ref != 'refs/heads/main'
id: create_prerelease
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "v${{ env.GitVersion_SemVer }}"
prerelease: true
title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}"
files: |
target/*.zip
target/*.tar.gz
- name: Remove old releases
if: github.ref == 'refs/heads/main'
uses: s00d/[email protected]
with:
#repo: <owner>/<repoName> # defaults to current repo
keep_latest: 3
delete_tag_pattern: v
delete_type: 'release'
delete_branch: 'main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if: github.ref == 'refs/heads/main'
id: create_release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "v${{ env.GitVersion_SemVer }}"
prerelease: false
title: "OoliteAddonScanner v${{ env.GitVersion_SemVer }}"
files: |
target/*.zip
target/*.tar.gz