Skip to content

Commit

Permalink
devonfw#512: fix GitHub actions nightly build (devonfw#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-vcapgemini authored Aug 6, 2024
1 parent 7def0a6 commit 5061acf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/check-for-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- cron: '0 2 * * *'

jobs:
# Checks if new commits since 24 hours of the last call of this workflow were found and adjusts the GITHUB_OUTPUT accordingly
verify_commit:
runs-on: ubuntu-latest
outputs:
Expand All @@ -15,11 +16,12 @@ jobs:
- id: verify_commit
run: |
if git log --since='24 hours ago' --oneline | grep '.'; then
echo "::set-output name=RUN_BUILD::true"
echo "RUN_BUILD=true" >> $GITHUB_OUTPUT
else
echo "::set-output name=RUN_BUILD::false"
echo "RUN_BUILD=false" >> $GITHUB_OUTPUT
fi
# Starts nightly_build workflow when new commits were found
trigger_build:
runs-on: ubuntu-latest
needs: verify_commit
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,3 @@ jobs:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dgpg.skip=true -Dstyle.color=always -B -ntp -Pdeploy deploy

check_status:
runs-on: ubuntu-latest
steps:
- name: Check last workflow status
id: check_status
run: |
workflow_filename="nightly-build.yml"
last_workflow=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/$workflow_filename/runs?per_page=1" | jq -r '.workflow_runs[0]')
conclusion=$(echo $last_workflow | jq -r '.conclusion')
echo "conclusion=$conclusion" >> $GITHUB_ENV
- name: Print and handle the status
run: |
echo "The status of the last workflow run is: ${{ env.conclusion }}"
if [ "${{ env.conclusion }}" != "success" ]; then
echo "The last workflow did not succeed. Failing this workflow."
exit 1
else
echo "The last workflow succeeded. This workflow will succeed."
fi

0 comments on commit 5061acf

Please sign in to comment.