forked from devonfw/IDEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update check-previous-workflow-status.yml
- Loading branch information
Showing
1 changed file
with
20 additions
and
65 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,27 @@ | ||
name: Nightly Build | ||
name: Check Previous Workflow Status | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 2 * * *' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
verify_commit: | ||
check-status: | ||
runs-on: ubuntu-latest | ||
name: Verify latest commit | ||
outputs: | ||
RUN_BUILD: ${{ steps.verify_commit.outputs.RUN_BUILD }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: verify_commit | ||
name: Verify latest commit is less than 24 hours | ||
if: ${{ (github.event_name == 'schedule') || (github.event_name == 'workflow_dispatch') }} | ||
run: echo '::set-output name=RUN_BUILD::'$(test -n "$(git log --format=%H --since='24 hours ago')" && echo 'true' || echo 'false') | ||
|
||
build-natives: | ||
name: Build native images | ||
runs-on: ${{ matrix.os }} | ||
needs: verify_commit | ||
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest, macos-13] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: graalvm/setup-graalvm@v1 | ||
with: | ||
java-version: '21.0.2' | ||
distribution: 'graalvm' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
native-image-job-reports: 'true' | ||
- name: Build native images with nativ maven plugin and extract in tar.gz | ||
shell: bash | ||
- name: Check last workflow status | ||
id: check_status | ||
run: | | ||
cd cli | ||
mvn -B -ntp -Pnative -P!include-docs -DskipTests=true package | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: natives | ||
path: cli/target/*.tar.gz | ||
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 | ||
build: | ||
name: Build Project and Deploy | ||
needs: [build-natives, verify_commit] | ||
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '17' | ||
- uses: actions/download-artifact@v3 | ||
- name: Make natives available and build project | ||
- name: Print and handle the status | ||
run: | | ||
mvn -B -ntp -Dstyle.color=always install | ||
mv ./natives/* ./cli/target/ | ||
- name: Deploy to OSSRH nexus | ||
env: | ||
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 -P deploy deploy | ||
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 |