-
-
Notifications
You must be signed in to change notification settings - Fork 67
115 lines (109 loc) · 5.46 KB
/
test-build.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
# Making changes? https://github.com/nektos/act may help you test locally
name: Configurate CI
on:
push:
branches: ["**"]
tags-ignore: ["**"]
pull_request:
release:
types: [released]
concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true
jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: [ubuntu-20.04, windows-latest]
steps:
# Setup
- name: setup
id: setup
uses: SpongePowered/.github/.github/actions/setup-java-env@master
with:
runtime_version: 11
publishing_branch_regex: "master|3\\.x|(?:release/[\\d.x]+)"
# Actually build
- name: Run Gradle Build
run: "./gradlew build"
- name: Archive test results
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: "test-results-${{ runner.os }}"
path: |
build/reports/
*/build/reports/
format/*/build/reports/
extra/*/build/reports/
vendor/*/build/reports/
vendor/*/*/build/reports/
# Then deploy, but only on the main branch
- name: Determine status
shell: bash
run: |
VERSION="$(./gradlew properties | awk '/^version:/ { print $2; }')"
if [ "$(echo $VERSION | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish with Gradle
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
run: |
mkdir -p build/publish-jd/configurate
./gradlew publish gitPublishCopy copyJavadoc --output build/publish-jd/configurate closeSonatypeStagingRepository
env:
ORG_GRADLE_PROJECT_githubPackagesUsername: "${{ github.actor }}"
ORG_GRADLE_PROJECT_githubPackagesPassword: "${{ secrets.GITHUB_TOKEN }}"
ORG_GRADLE_PROJECT_spongeSnapshotRepo: "${{ secrets.SPONGE_MAVEN_SNAPSHOT_REPO_URL }}"
ORG_GRADLE_PROJECT_spongeReleaseRepo: "${{ secrets.SPONGE_MAVEN_RELEASE_REPO_URL }}"
ORG_GRADLE_PROJECT_spongeUsername: "${{ secrets.SPONGE_MAVEN_REPO_USER }}"
ORG_GRADLE_PROJECT_spongePassword: "${{ secrets.SPONGE_MAVEN_REPO_PASSWORD }}"
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SPONGE_MAVEN_OSSRH_USER }}"
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SPONGE_MAVEN_OSSRH_PASSWORD }}"
ORG_GRADLE_PROJECT_spongeSigningKey: "${{ secrets.SPONGE_SIGNING_KEY }}"
ORG_GRADLE_PROJECT_spongeSigningPassword: "${{ secrets.SPONGE_SIGNING_PASSWORD }}"
ORG_GRADLE_PROJECT_spongeKeyStore: "${{ secrets.CONFIGURATE_JARSIGNING_KEY }}"
ORG_GRADLE_PROJECT_spongeKeyStoreAlias: "${{ secrets.CONFIGURATE_JARSIGNING_ALIAS }}"
ORG_GRADLE_PROJECT_spongeKeyStorePassword: "${{ secrets.CONFIGURATE_JARSIGNING_PASSWORD }}"
- name: Publish to GH pages
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
uses: JamesIves/[email protected]
with:
branch: gh-pages
force: false
folder: build/gitPublish
- name: "Authenticate for JD publication"
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
uses: "tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a" # v2.1.0
id: jd-token
with:
app_id: "${{ secrets.JAVADOC_PUBLISH_APP_ID }}"
private_key: "${{ secrets.JAVADOC_PUBLISH_APP_KEY }}"
installation_retrieval_mode: "repository"
installation_retrieval_payload: "SpongePowered/APIJavadocs"
- name: Publish Javadoc to Sponge index
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (steps.setup.outputs.publishing_branch != ''))) }}"
uses: JamesIves/[email protected]
with:
folder: build/publish-jd
repository-name: SpongePowered/APIJavadocs
token: ${{ steps.jd-token.outputs.token }}
branch: data
git-config-name: spongie-jd[bot]
git-config-email: "167721471+spongie-jd[bot]@users.noreply.github.com"
clean: false
force: false
commit-message: "Publishing javadoc for ${{ github.repository }} ${{ env.VERSION }}"
- name: Publish configurate-tool as release artifact
if: "${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'release' }}"
uses: softprops/action-gh-release@v2
with:
files: |
tool/build/distributions/tool-${{ env.VERSION }}.tar.gz
tool/build/distributions/tool-${{ env.VERSION }}.zip