Repository navigation
59 lines (49 loc) · 1.91 KB
/
Copy pathrelease.yml
File metadata and controls
59 lines (49 loc) · 1.91 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
name: Release
# Push a tag named like the version (0.1.0, 0.2.0-beta.1) to release it: the plugin jar is built with
# that version, attached to a GitHub release, and uploaded to Hangar. maven.yml publishes the Maven
# artifacts from the same tag.
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
permissions:
contents: write
jobs:
release:
if: github.repository == '1robie/MachineEngine'
runs-on: ubuntu-latest
env:
VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Releases come from main only (docs/BRANCHING_PLAN.md): a tag pushed on develop publishes nothing.
- name: Check the tag is on main
run: |
git merge-base --is-ancestor HEAD origin/main \
|| { echo "::error::Tag $VERSION is not on main. Merge develop into main first, then tag main."; exit 1; }
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: |
21
25
- uses: gradle/actions/setup-gradle@v4
- name: Build and test
run: ./gradlew build -Pversion="$VERSION" --console=plain
# A patch release must not break the API (§5); a minor one before 1.0 may, listed in CHANGELOG.md.
- name: Check API binary compatibility
run: ./gradlew :api:japicmp -Pversion="$VERSION" --console=plain
- name: GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
prerelease=""
case "$VERSION" in *-*) prerelease="--prerelease" ;; esac
gh release create "$VERSION" "plugin/build/libs/MachineEngine-$VERSION.jar" \
--title "MachineEngine $VERSION" --generate-notes $prerelease
- name: Hangar
env:
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
run: ./gradlew :plugin:publishPluginPublicationToHangar -Pversion="$VERSION" --console=plain