-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (61 loc) · 1.84 KB
/
buildAndRelease.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
name: Build
on:
[push]
jobs:
build:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'maven'
- name: Extract version from tag and set it as project version
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
mvn versions:set --file pom.xml -DnewVersion=${GITHUB_REF##*/}
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Uploads the build artifact
uses: actions/upload-artifact@v4
with:
name: ${{runner.os}}.zip
path: target/reverseCharger-*.zip
release:
name: Draft a Release on GitHub Releases
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
env:
BUILD_VERSION: DUMMY
steps:
- name: Get version from tag and set up environment
run: echo "BUILD_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Draft a release
uses: softprops/action-gh-release@v1
with:
discussion_category_name: releases
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
generate_release_notes: true
body: |-
:construction: Work in Progress
- name: Publish build artifacts on release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
reverseCharger-*.zip