Nightly Release #1740
This file contains hidden or 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: Nightly Release | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| activity-check: | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| outputs: | |
| stale: ${{ steps.activity_check.outputs.stale }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Activity check | |
| id: activity_check | |
| run: | | |
| # get the author and timestamp of the latest commit | |
| AUTHOR=$(git log -1 --pretty=format:'%an') | |
| # Get the commit date in ISO 8601 format (UTC) | |
| COMMIT_DATE=$(git log -1 --pretty=format:'%cI') | |
| echo "Commit date: $COMMIT_DATE" | |
| # Convert both dates to epoch seconds | |
| COMMIT_EPOCH=$(date -d "$COMMIT_DATE" +%s) | |
| NOW_EPOCH=$(date -u +%s) | |
| # Calculate difference in seconds | |
| AGE_SECONDS=$(( NOW_EPOCH - COMMIT_EPOCH )) | |
| # 86400 seconds = 24 hours | |
| echo "Latest Repository activity : $COMMIT_DATE $AUTHOR, $AGE_SECONDS seconds ago" | |
| STALE=false | |
| if [ "${{ github.event_name }}" == "repository_dispatch" ]; then | |
| echo "[WARNING] Ignoring activity limits : workflow triggered manually" | |
| STALE=false | |
| elif [ "$AGE_SECONDS" -gt 86400 ]; then | |
| echo "[ERROR] Repository not updated : event<${{ github.event_name }}> not allowed to modify stale repository" | |
| echo "Commit is stale (older than 24 hours)" | |
| STALE=true | |
| else | |
| echo "Commit is fresh (within last 24 hours)" | |
| STALE=false | |
| fi | |
| echo "stale=$STALE" >> $GITHUB_OUTPUT | |
| if [ "$STALE" == "true" ]; then | |
| exit 1 | |
| fi | |
| shell: bash | |
| build: | |
| needs: [activity-check] | |
| if: needs.activity-check.outputs.stale != 'true' | |
| uses: ./.github/workflows/build-reusable.yaml | |
| create-release: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| datestamp: ${{ env.DATESTAMP }} | |
| env: | |
| ARTIFACTS_DIR: artifacts | |
| steps: | |
| - name: Run Configuration Commands | |
| id: metadata | |
| run: | | |
| DATESTAMP="$(date --utc '+%Y.%m.%d')" | |
| echo "Version: ${DATESTAMP}-nightly" | |
| # Setup environment variables | |
| echo "datestamp=${DATESTAMP}" >> $GITHUB_OUTPUT | |
| echo "dateword=$(date --utc '+%B %d, %Y')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Download Built Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ env.ARTIFACTS_DIR }} | |
| merge-multiple: true | |
| - name: List downloaded artifacts | |
| run: | | |
| echo "Contents of ${{ env.ARTIFACTS_DIR }}" | |
| ls -R ${{ env.ARTIFACTS_DIR }} | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.metadata.outputs.datestamp }} | |
| name: "Nightly: ${{ steps.metadata.outputs.dateword }}" | |
| body: | | |
| **Automated Nightly Release** | |
| ${{ steps.metadata.outputs.datestamp }}-nightly | |
| draft: false | |
| files: | | |
| ${{ env.ARTIFACTS_DIR }}/* |