YAML comments support #1974
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
env: | |
JAVA_VERSION: 11 | |
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: Check out | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # checkout full history for site generation | |
submodules: recursive | |
- name: Set up committer info for patching | |
run: | | |
git config --global user.email "noreply@spongepowered.org" | |
git config --global user.name "github-actions" | |
- name: "Setup JDK ${{ env.JAVA_VERSION }}" | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: "${{ env.JAVA_VERSION }}" | |
- uses: gradle/wrapper-validation-action@v1 | |
# Actually build | |
- name: Run Gradle Build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: "${{ !(github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x' || startsWith(github.ref, 'refs/heads/release/')) || github.event_name == 'pull_request' }}" | |
arguments: build | |
- name: Archive test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "test-results-${{ runner.os }}" | |
path: | | |
build/reports/ | |
*/build/reports/ | |
format/*/build/reports/ | |
extra/*/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' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x' || startsWith(github.ref, 'refs/heads/release/')))) }}" | |
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' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x'))) }}" | |
uses: JamesIves/github-pages-deploy-action@v4.4.3 | |
with: | |
branch: gh-pages | |
force: false | |
folder: build/gitPublish | |
- name: Publish Javadoc to Sponge index | |
if: "${{ runner.os == 'Linux' && ((env.STATUS == 'release' && github.event_name == 'release') || (env.STATUS != 'release' && github.event_name != 'release' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/3.x'))) }}" | |
uses: JamesIves/github-pages-deploy-action@v4.4.3 | |
with: | |
folder: build/publish-jd | |
ssh-key: "${{ secrets.SPONGE_JD_DEPLOY_KEY }}" | |
repository-name: SpongePowered/APIJavadocs | |
branch: data | |
git-config-name: Spongie | |
git-config-email: staff@spongepowered.org | |
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@v1 | |
with: | |
files: | | |
tool/build/distributions/tool-${{ env.VERSION }}.tar.gz | |
tool/build/distributions/tool-${{ env.VERSION }}.zip |