-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (88 loc) · 2.77 KB
/
release.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
name: Release
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
testing: ${{ steps.testing.outputs.testing }}
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
if: ${{ !env.ACT }}
uses: google-github-actions/release-please-action@v4
with:
token: "${{ secrets.GITHUB_TOKEN }}"
release-type: "maven"
- id: testing
if: ${{ env.ACT }}
run: echo "testing=true" >> $GITHUB_OUTPUT
build:
needs: create-release
name: Build
if: ( needs.create-release.outputs.testing || needs.create-release.outputs.release_created )
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 18 (Corretto)
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'corretto'
cache: maven
- name: Build with Maven
run: |
mvn -B package --file pom.xml
- name: Prepare artifacts
run: |
mkdir -p artifacts/player
mv player/target/teamgruen-player.jar artifacts/player/
mv sdk/target/sdk-*.jar artifacts/
mv player/assets/* artifacts/player/
zip -r -j artifacts/teamgruen-player.zip artifacts/player
rm -rf artifacts/*/
- name: Add artifacts to release
if: ${{ needs.create-release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.create-release.outputs.tag_name }} artifacts/*
- name: Upload artifact
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: archives
path: artifacts/*
deploy:
needs: [create-release, build]
name: Deploy
if: ${{ needs.create-release.outputs.release_created }}
runs-on: ubuntu-latest
environment: production
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: archives
path: artifacts
file: teamgruen-player.zip
- name: Upload client
uses: fjogeleit/http-request-action@v1
with:
url: 'https://sc-upload.justix.dev/api/v1/upload/${{ needs.create-release.outputs.tag_name }}?fileName=teamgruen-player.zip'
method: 'POST'
timeout: 5000
customHeaders: |
{
"Content-Type": "application/octet-stream",
"X-API-Key": "${{ secrets.UPLOAD_API_KEY }}"
}
file: artifacts/teamgruen-player.zip