-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (60 loc) · 1.96 KB
/
Copy pathbuild-and-release.yml
File metadata and controls
72 lines (60 loc) · 1.96 KB
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
name: Build & Release
on:
push:
branches: ["master"]
pull_request:
jobs:
build:
name: Build
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "temurin"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- name: Check code formatting
run: ./gradlew spotlessCheck
- name: Execute Gradle build
run: ./gradlew build
- name: Prepare files for release
if: github.ref_type == 'tag'
run: |
mkdir gh_release
cp LICENSE.md build/resources/main/config.default.yml build/libs/*-all.jar gh_release
- name: Upload artifact for release
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v7
with: &artifact-args
name: release-artifacts
path: gh_release
release:
name: Publish release
permissions:
contents: write
needs: build
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event_name == 'push'
steps:
- name: Download artifact
uses: actions/download-artifact@v8
with: *artifact-args
- name: Create release zip file
uses: TheDoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # v0.7.6
with:
filename: "GravenSupport-${{ github.sha }}.zip"
directory: ./gh_release
- name: Publish release '${{ github.ref_name }}'
uses: marvinpinto/action-automatic-releases@d68defdd11f9dcc7f52f35c1b7c236ee7513bcc1 # 'latest' tag. Warn: This action is archived.
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
prerelease: false
title: "GravenSupport '${{ github.ref_name }}'"
files: "./gh_release/GravenSupport-${{ github.sha }}.zip"