Publish Nightly #343
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
name: Publish Nightly | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 3 * * *" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Check if automatic run should exit early | |
if: github.event_name == 'schedule' | |
run: | | |
if [[ "$(git log --since='24 hours ago' | wc -l)" -eq 0 ]] || | |
[[ "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-s https://api.github.com/repos/${{ github.repository }}/actions/workflows \ | |
| jq '.workflow_runs[] | select(.event == "workflow_dispatch") | .created_at' \ | |
| grep -c "$(date -u +%F)" )" -gt 0 ]]; then | |
echo "Skipping automatic run" | |
exit 78 | |
fi | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Set Gradle Perms | |
run: chmod +x gradlew | |
- name: Set nightly version | |
run: ./gradlew setNightlyVersion | |
- name: Publish package | |
run: ./gradlew publish -Pnightly=true --info | |
env: | |
MAVEN_USER: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASS: ${{ secrets.MAVEN_PASSWORD }} | |
- name: Create Discord Embed | |
run: ./gradlew injectDiscordEmbed -Pnightly=true | |
- name: Send Discord Webhook | |
run: | | |
curl -H "Content-Type: application/json" -d @./build/nightly_embed.json ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }} |