Skip to content

Fix pawns selection bug, automatically enable build mode when pawns a… #170

Fix pawns selection bug, automatically enable build mode when pawns a…

Fix pawns selection bug, automatically enable build mode when pawns a… #170

name: Nightly Build and Publish
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}
- name: Retrieve all commit messages pushed and put in the environment variable GITHUB_COMMITS_TEXT
id: commits
run: |
export commitsText=$(git log --format=%s ${{ github.event.before }}..${{ github.sha }} | tr '\n' ':newline:')
echo "Commits texts: $commitsText"
echo "GITHUB_COMMITS_TEXT=$commitsText" >> $GITHUB_ENV
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_number }}
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@v2
with:
arguments: publishAllPublicationsToGitHubPackagesRepository
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_number }}
GITHUB_COMMITS_TEXT: ${{ env.GITHUB_COMMITS_TEXT }}
- name: Delete packages, keep most recent
uses: actions/delete-package-versions@v4
with:
package-name: 'org.minefortress.minefortress-nightly'
package-type: 'maven'
min-versions-to-keep: 10
discord-notification:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Send Discord Notification
run: |
messages=$(git log --reverse --format='- %s' ${{ github.event.before }}..${{ github.sha }})
./automation-scripts/discord-notification.sh ${{ secrets.DISCORD_WEBHOOK }} ${{ github.run_number }} "$messages" "${{ vars.DISCORD_ROLE_ID }}"
twitter-notification:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare twitter messages
id: prepare-twitter-messages
run: |
export messages=$(git log --reverse --format='- %s' ${{ github.event.before }}..${{ github.sha }})
echo "Twitter messages: $messages"
echo "twitterMessages=${messages//$'\n'/'\\n'}" >> $GITHUB_OUTPUT
- name: Send Twitter Notification
uses: remmintan/[email protected]
with:
api-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
api-key-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET_KEY }}
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
tweet-text: |
MineFortress Dev Build ${{ github.run_number }} built successfully!
Changes:
${{ steps.prepare-twitter-messages.outputs.twitterMessages }}
===next-tweet===
Dev Builds portal:
https://builds.minecraftfortress.org
reddit-notification:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare reddit messages
id: prepare-reddit-messages
run: |
export messages=$(git log --reverse --format='- %s' ${{ github.event.before }}..${{ github.sha }})
echo "Reddit messages: $messages"
echo "redditMessages=${messages//$'\n'/'\\n'}" >> $GITHUB_OUTPUT
- name: Send Reddit Notification
uses: remmintan/[email protected]
with:
app-id: ${{ secrets.REDDIT_APP_ID }}
app-secret: ${{ secrets.REDDIT_APP_SECRET }}
username: ${{ secrets.REDDIT_USERNAME }}
password: ${{ secrets.REDDIT_PASSWORD }}
post-title: MineFortress dev build ${{ github.run_number }} built successfully!
post-text: |
Changes:
${{ steps.prepare-reddit-messages.outputs.redditMessages }}
https://builds.minecraftfortress.org