-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (71 loc) · 2.74 KB
/
release_beta.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
name: Next Beta
on: [workflow_dispatch] # Manual trigger
jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [11]
# and run on both Linux and Windows
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get previous tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- name: Get SemVer increments
id: semver
uses: WyriHaximus/github-action-next-semvers@v1.0
with:
version: ${{ steps.previous-tag.outputs.tag }}
- name: Create version tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
let oldTag = "${{ steps.previous-tag.outputs.tag }}"
let regex = /[v]?([0-9]+\.[0-9]+\.[0-9]+)+-beta.([0-9]+)[+]?.*/
if (regex.test(oldTag)) {
let match = oldTag.match(regex)
let betaIncrement = parseInt(match[2], 10) + 1
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/v" + match[1] + "-beta." + betaIncrement,
sha: context.sha
})
}
- name: Fetch tags
run: git fetch --tags
- name: Get current tag
id: current-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Make Gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build
run: ./gradlew generateChangelog build publish curseforge github publishModrinth --stacktrace --parallel -PlastTag="${{ steps.previous-tag.outputs.tag }}" -PcurrentTag="${{ steps.current-tag.outputs.tag }}"
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_API_KEY }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
DISCORD_ANNOUNCEMENT_WEBHOOK: ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/