-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions to replace TeamCity as CI (#309)
- Loading branch information
Showing
6 changed files
with
305 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
name: Publish bleeding export | ||
|
||
jobs: | ||
publish: | ||
name: Publish export | ||
runs-on: ubuntu-latest | ||
outputs: | ||
CI_VERSION: ${{ steps.info.outputs.CI_VERSION }} | ||
CI_GROUP: ${{ steps.info.outputs.CI_GROUP }} | ||
CI_ARTIFACT: ${{ steps.info.outputs.CI_ARTIFACT }} | ||
CI_GAME_VERSION: ${{ steps.info.outputs.CI_GAME_VERSION }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Obtain GAV info | ||
id: info | ||
run: ./gradlew --quiet printGHActionsOutput >> "$GITHUB_OUTPUT" | ||
|
||
- name: Publish export | ||
run: ./gradlew publishExport -PreleaseType=bleeding | ||
env: | ||
LDTTeamJfrogUsername: ${{ secrets.PUBLISHING_USERNAME }} | ||
LDTTeamJfrogPassword: ${{ secrets.PUBLISHING_PASSWORD }} | ||
announce: | ||
name: Send announcement message | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download discord.sh | ||
run: curl -LOJ https://github.com/fieu/discord.sh/releases/download/v2.0.0/discord.sh | ||
|
||
- name: Set discord.sh executable | ||
run: chmod +x discord.sh | ||
|
||
- name: Send announcement message | ||
run: | | ||
./discord.sh \ | ||
--webhook-url="$WEBHOOK" \ | ||
--username "ParchmentMC" \ | ||
--color "0xFF0000" \ | ||
--title "New bleeding for \`$CI_GAME_VERSION!\`" \ | ||
--field "Version;\`$CI_VERSION\`;false" \ | ||
--field "Group;\`$CI_GROUP\`;true" \ | ||
--field "Artifact;\`$CI_ARTIFACT\`;true" \ | ||
--field "Coordinate;\`$CI_GROUP:$CI_ARTIFACT:$CI_VERSION\`;false" \ | ||
--timestamp | ||
env: | ||
WEBHOOK: ${{ secrets.BLEEDING_DISCORD_WEBHOOK }} | ||
CI_VERSION: ${{ needs.publish.outputs.CI_VERSION }} | ||
CI_GROUP: ${{ needs.publish.outputs.CI_GROUP }} | ||
CI_ARTIFACT: ${{ needs.publish.outputs.CI_ARTIFACT }} | ||
CI_GAME_VERSION: ${{ needs.publish.outputs.CI_GAME_VERSION }} | ||
set-variables: | ||
name: Set repository variables | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Mark pending variables | ||
run: | | ||
gh -R $GITHUB_SERVER_URL/$GITHUB_REPOSITORY variable set HAS_PENDING_NIGHTLY --body "true" | ||
gh -R $GITHUB_SERVER_URL/$GITHUB_REPOSITORY variable set HAS_PENDING_RELEASE --body "true" | ||
env: | ||
# This should be a GH PAT with 'repo' scope | ||
GH_TOKEN: ${{ secrets.VARIABLES_GH_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 12 * * *" # 12NN every day | ||
|
||
name: Publish nightly export | ||
|
||
jobs: | ||
publish: | ||
name: Publish export | ||
runs-on: ubuntu-latest | ||
# If triggered by schedule, only run if the variable is set to true | ||
# (This allows the workflow to be triggered manually) | ||
if: ${{ github.event_name != 'schedule' || fromJSON(vars.HAS_PENDING_NIGHTLY) == true }} | ||
outputs: | ||
CI_VERSION: ${{ steps.info.outputs.CI_VERSION }} | ||
CI_GROUP: ${{ steps.info.outputs.CI_GROUP }} | ||
CI_ARTIFACT: ${{ steps.info.outputs.CI_ARTIFACT }} | ||
CI_GAME_VERSION: ${{ steps.info.outputs.CI_GAME_VERSION }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Obtain GAV info | ||
id: info | ||
run: ./gradlew --quiet printGHActionsOutput >> "$GITHUB_OUTPUT" | ||
|
||
- name: Publish export | ||
run: ./gradlew publishExport -PreleaseType=nightly | ||
env: | ||
LDTTeamJfrogUsername: ${{ secrets.PUBLISHING_USERNAME }} | ||
LDTTeamJfrogPassword: ${{ secrets.PUBLISHING_PASSWORD }} | ||
announce: | ||
name: Send announcement message | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download discord.sh | ||
run: curl -LOJ https://github.com/fieu/discord.sh/releases/download/v2.0.0/discord.sh | ||
|
||
- name: Set discord.sh executable | ||
run: chmod +x discord.sh | ||
|
||
- name: Send announcement message | ||
run: | | ||
./discord.sh \ | ||
--webhook-url="$WEBHOOK" \ | ||
--username "ParchmentMC" \ | ||
--color "0xFFA500" \ | ||
--title "New nightly for \`$CI_GAME_VERSION!\`" \ | ||
--field "Version;\`$CI_VERSION\`;false" \ | ||
--field "Group;\`$CI_GROUP\`;true" \ | ||
--field "Artifact;\`$CI_ARTIFACT\`;true" \ | ||
--field "Coordinate;\`$CI_GROUP:$CI_ARTIFACT:$CI_VERSION\`;false" \ | ||
--timestamp | ||
env: | ||
WEBHOOK: ${{ secrets.NIGHTLY_DISCORD_WEBHOOK }} | ||
CI_VERSION: ${{ needs.publish.outputs.CI_VERSION }} | ||
CI_GROUP: ${{ needs.publish.outputs.CI_GROUP }} | ||
CI_ARTIFACT: ${{ needs.publish.outputs.CI_ARTIFACT }} | ||
CI_GAME_VERSION: ${{ needs.publish.outputs.CI_GAME_VERSION }} | ||
set-variables: | ||
name: Set repository variables | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Unmark pending variable | ||
run: | | ||
gh -R $GITHUB_SERVER_URL/$GITHUB_REPOSITORY variable set HAS_PENDING_NIGHTLY --body "false" | ||
env: | ||
# This should be a GH PAT with 'repo' scope | ||
GH_TOKEN: ${{ secrets.VARIABLES_GH_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
on: | ||
- pull_request | ||
|
||
name: Validate PR | ||
|
||
jobs: | ||
build: | ||
name: Build and validate PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Run validation task | ||
run: ./gradlew validateData | ||
|
||
- name: Upload ZIPs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: export-zips | ||
path: build/exportZips/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 12 * * 0" # 12NN on Sundays | ||
|
||
name: Publish release export | ||
|
||
permissions: | ||
contents: write # For creating and pushing the tag | ||
|
||
jobs: | ||
publish: | ||
name: Publish export | ||
runs-on: ubuntu-latest | ||
# If triggered by schedule, only run if the variable is set to true | ||
# (This allows the workflow to be triggered manually) | ||
if: ${{ github.event_name != 'schedule' || fromJSON(vars.HAS_PENDING_RELEASE) == true }} | ||
outputs: | ||
CI_VERSION: ${{ steps.info.outputs.CI_VERSION }} | ||
CI_GROUP: ${{ steps.info.outputs.CI_GROUP }} | ||
CI_ARTIFACT: ${{ steps.info.outputs.CI_ARTIFACT }} | ||
CI_GAME_VERSION: ${{ steps.info.outputs.CI_GAME_VERSION }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Obtain GAV info | ||
id: info | ||
run: ./gradlew --quiet printGHActionsOutput >> "$GITHUB_OUTPUT" | ||
|
||
- name: Publish export | ||
run: ./gradlew publishExport -PreleaseType=release | ||
env: | ||
LDTTeamJfrogUsername: ${{ secrets.PUBLISHING_USERNAME }} | ||
LDTTeamJfrogPassword: ${{ secrets.PUBLISHING_PASSWORD }} | ||
create-tag: | ||
name: Create tag | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create tag | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/releases/${{ needs.publish.outputs.CI_GAME_VERSION }}-${{ needs.publish.outputs.CI_VERSION }}', | ||
sha: context.sha | ||
}) | ||
announce: | ||
name: Send announcement message | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download discord.sh | ||
run: curl -LOJ https://github.com/fieu/discord.sh/releases/download/v2.0.0/discord.sh | ||
|
||
- name: Set discord.sh executable | ||
run: chmod +x discord.sh | ||
|
||
- name: Send announcement message | ||
run: | | ||
./discord.sh \ | ||
--webhook-url="$WEBHOOK" \ | ||
--username "ParchmentMC" \ | ||
--color "0x228B22" \ | ||
--title "New release for \`$CI_GAME_VERSION!\`" \ | ||
--field "Version;\`$CI_VERSION\`;false" \ | ||
--field "Group;\`$CI_GROUP\`;true" \ | ||
--field "Artifact;\`$CI_ARTIFACT\`;true" \ | ||
--field "Coordinate;\`$CI_GROUP:$CI_ARTIFACT:$CI_VERSION\`;false" \ | ||
--timestamp | ||
env: | ||
WEBHOOK: ${{ secrets.RELEASES_DISCORD_WEBHOOK }} | ||
CI_VERSION: ${{ needs.publish.outputs.CI_VERSION }} | ||
CI_GROUP: ${{ needs.publish.outputs.CI_GROUP }} | ||
CI_ARTIFACT: ${{ needs.publish.outputs.CI_ARTIFACT }} | ||
CI_GAME_VERSION: ${{ needs.publish.outputs.CI_GAME_VERSION }} | ||
set-variables: | ||
name: Set repository variables | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Unmark pending variables | ||
run: | | ||
gh -R $GITHUB_SERVER_URL/$GITHUB_REPOSITORY variable set HAS_PENDING_RELEASE --body "false" | ||
env: | ||
# This should be a GH PAT with 'repo' scope | ||
GH_TOKEN: ${{ secrets.VARIABLES_GH_TOKEN }} |
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
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