-
-
Notifications
You must be signed in to change notification settings - Fork 95
137 lines (121 loc) · 4.34 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Release LITIENGINE
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
incrementVersion:
type: choice
description: "increment version?"
required: true
default: 'none'
options:
- none
- patch
- minor
- major
schedule:
# Midnight every day
- cron: "0 0 * * *"
permissions:
contents: write
jobs:
release:
name: Release build
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: JDK Setup
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 23
- name: Gradle Setup
uses: gradle/actions/setup-gradle@v4
- name: Increment version
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != ''
env:
GRGIT_USER: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew incrementVersion --increment=${{inputs.incrementVersion}}
./gradlew pushTags
latest_tag=$(git describe --tags --abbrev=0)
echo "RELEASE_VERSION=$latest_tag" >> "$GITHUB_ENV"
- name: Publish Snapshot
if: inputs.incrementVersion == 'none' || inputs.incrementVersion == ''
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}
run: ./gradlew publishToSonatype closeSonatypeStagingRepository
- name: Publish Stable
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != ''
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Create release notes
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$RELEASE_VERSION" \
--repo="$GITHUB_REPOSITORY" \
--title="$RELEASE_VERSION" \
--generate-notes \
--draft
- name: Announce release
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != ''
run: |
curl -X POST -H "Authorization: Bearer ${{ secrets.MASTODON_ACCESS_TOKEN }}" \
-F "status=#LITIENGINE version ${{ env.RELEASE_VERSION }} has just been released!
#GameDev #indiedev #videogames #IndieGameDev
${{ github.server_url }}/${{ github.repository }}/releases/tag/$RELEASE_VERSION" \
https://fosstodon.org/api/v1/statuses
package:
name: Package distribution
if: inputs.incrementVersion != 'none' && inputs.incrementVersion != ''
needs: release
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 23
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Package
run: ./gradlew jpackage -Prelease=true
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: utiLITI-${{ runner.os }}
path: utiliti/build/jpackage
- name: Set up Butler
if: runner.arch == 'X64'
uses: jdno/setup-butler@v1
- name: Upload to itch.io
if: runner.arch == 'X64'
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "RELEASE_VERSION=$latest_tag" >> "$GITHUB_ENV"
butler push utiliti/build/jpackage gurkenlabs/litiengine:${{ runner.os }} --userversion $RELEASE_VERSION