Publish Nightly #237
Workflow file for this run
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-nightly: | |
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 | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }} | |
raw-data: build/nightly_embed.json |