Skip to content

Commit

Permalink
ci: use reusable nightly workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Aug 27, 2024
1 parent 5f937fa commit 0baa855
Showing 1 changed file with 6 additions and 61 deletions.
67 changes: 6 additions & 61 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,15 @@ on:
schedule:
- cron: "0 3 * * *" # run at 03:00 UTC

env:
INPUT_VERSION: ${{ github.event.inputs.version || inputs.version }}

jobs:
Secrets-Presence:
name: "Check for required credentials"
runs-on: ubuntu-latest
outputs:
HAS_OSSRH: ${{ steps.secrets-presence.outputs.HAS_OSSRH }}
HAS_WEBHOOK: ${{ steps.secrets-presence.outputs.HAS_WEBHOOK }}
steps:
- name: Check whether secrets exist
id: secrets-presence
run: |
[ ! -z "${{ secrets.ORG_GPG_PASSPHRASE }}" ] &&
[ ! -z "${{ secrets.ORG_GPG_PRIVATE_KEY }}" ] &&
[ ! -z "${{ secrets.ORG_OSSRH_USERNAME }}" ] && echo "HAS_OSSRH=true" >> $GITHUB_OUTPUT
[ ! -z "${{ secrets.DISCORD_GITHUB_CI_WEBHOOK }}" ] && echo "HAS_WEBHOOK=true" >> $GITHUB_OUTPUT
exit 0
Determine-Version:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get-version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- name: "Get version"
id: get-version
run: |
if [ -z ${{ env.INPUT_VERSION }} ]; then
echo "VERSION=$(IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<$(grep "version" gradle.properties | awk -F= '{print $2}') && echo $RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$RELEASE_VERSION_PATCH-$(date +"%Y%m%d")-SNAPSHOT)" >> "$GITHUB_OUTPUT"
else
echo "VERSION=${{ env.INPUT_VERSION }}" >> "$GITHUB_OUTPUT"
fi

Run-Tests:
uses: ./.github/workflows/verify.yaml
secrets: inherit

Publish-Artefacts:
runs-on: ubuntu-latest
needs: [ Secrets-Presence, Run-Tests, Determine-Version ]
if: |
needs.Secrets-Presence.outputs.HAS_OSSRH
steps:
- uses: eclipse-edc/.github/.github/actions/publish-maven-artifacts@main
with:
version: ${{ needs.Determine-Version.outputs.VERSION }}
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.ORG_GPG_PASSPHRASE }}
osshr-username: ${{ secrets.ORG_OSSRH_USERNAME }}
osshr-password: ${{ secrets.ORG_OSSRH_PASSWORD }}

Post-To-Discord:
needs: [ Publish-Artefacts, Determine-Version, Secrets-Presence ]
if: "needs.Secrets-Presence.outputs.HAS_WEBHOOK && always()"
runs-on: ubuntu-latest
steps:
- uses: sarisia/actions-status-discord@v1
name: "Invoke discord webhook"
with:
webhook: ${{ secrets.DISCORD_GITHUB_CI_WEBHOOK }}
# if the publishing is skipped, that means the preceding test run failed
status: ${{ needs.Publish-Artefacts.result == 'skipped' && 'Failure' || needs.Publish-Artefacts.result }}
title: "Release Build Technology AWS"
description: "Build and publish ${{ needs.Determine-Version.outputs.VERSION }}"
username: GitHub Actions
Publish:
needs: [ Run-Tests ]
uses: eclipse-edc/.github/.github/workflows/technology-nightly.yml@main
secrets: inherit
with:
version: ${{ inputs.version }}

0 comments on commit 0baa855

Please sign in to comment.