|
12 | 12 | - cron: '0 0 * * *' # Runs every day at midnight UTC |
13 | 13 |
|
14 | 14 | jobs: |
| 15 | + check: |
| 16 | + name: Determine Build Necessity |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + proceed: ${{ steps.check.outputs.proceed }} |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v5 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + - name: Get the last nightly commit |
| 25 | + id: last_nightly |
| 26 | + uses: actions/github-script@v7 |
| 27 | + with: |
| 28 | + script: | |
| 29 | + const releases = await github.rest.repos.listReleases({ |
| 30 | + owner: context.repo.owner, |
| 31 | + repo: context.repo.repo, |
| 32 | + per_page: 100 |
| 33 | + }); |
| 34 | + const nightlyRelease = releases.data.find(release => release.tag_name.includes('nightly') || release.name.includes('Nightly')); |
| 35 | + if (nightlyRelease) { |
| 36 | + const tagName = nightlyRelease.tag_name; |
| 37 | + const tag = await github.rest.git.getRef({ |
| 38 | + owner: context.repo.owner, |
| 39 | + repo: context.repo.repo, |
| 40 | + ref: `tags/${tagName}` |
| 41 | + }); |
| 42 | + const commitSha = tag.data.object.sha; |
| 43 | + return commitSha; |
| 44 | + } else { |
| 45 | + return null; |
| 46 | + } |
| 47 | + - name: Check the proceed condition |
| 48 | + id: check |
| 49 | + run: | |
| 50 | + LAST_NIGHTLY_COMMIT="${{ steps.last_nightly.outputs.result }}" |
| 51 | + CURRENT_COMMIT="${GITHUB_SHA}" |
| 52 | + echo "Last nightly commit: $LAST_NIGHTLY_COMMIT" |
| 53 | + echo "Current commit: $CURRENT_COMMIT" |
| 54 | + if [ -z "$LAST_NIGHTLY_COMMIT" ]; then |
| 55 | + echo "No previous nightly release found. Proceeding with build." |
| 56 | + echo "proceed=true" >> $GITHUB_OUTPUT |
| 57 | + elif [ "$LAST_NIGHTLY_COMMIT" != "$CURRENT_COMMIT" ]; then |
| 58 | + echo "New commits found since last nightly release. Proceeding with build." |
| 59 | + echo "proceed=true" >> $GITHUB_OUTPUT |
| 60 | + else |
| 61 | + echo "No new commits since last nightly release. Skipping build." |
| 62 | + echo "proceed=false" >> $GITHUB_OUTPUT |
| 63 | + fi |
15 | 64 | build: |
16 | 65 | name: Nightly Build on ${{ matrix.os }} |
| 66 | + needs: check |
| 67 | + if: needs.check.outputs.proceed == 'true' |
17 | 68 | runs-on: ${{ matrix.os }} |
18 | 69 | strategy: |
| 70 | + fail-fast: false |
19 | 71 | matrix: |
20 | 72 | os: [windows-latest, macos-latest] |
21 | 73 | steps: |
@@ -58,12 +110,15 @@ jobs: |
58 | 110 | luamake soluna |
59 | 111 | if [[ "$RUNNER_OS" == "Windows" ]]; then |
60 | 112 | SOLUNA_BINARY="soluna.exe" |
| 113 | + RENAME_BINARY="soluna-windows-amd64.exe" |
61 | 114 | else |
62 | 115 | SOLUNA_BINARY="soluna" |
| 116 | + RENAME_BINARY="soluna-macos-arm64" |
63 | 117 | fi |
64 | 118 | SOLUNA_PATH=$(find bin -name $SOLUNA_BINARY | head -n 1) |
65 | | - echo "SOLUNA_PATH=$SOLUNA_PATH" >> $GITHUB_OUTPUT |
66 | | - echo "SOLUNA_BINARY=$SOLUNA_BINARY" >> $GITHUB_OUTPUT |
| 119 | + cp "$SOLUNA_PATH" "bin/$RENAME_BINARY" |
| 120 | + echo "SOLUNA_PATH=bin/$RENAME_BINARY" >> $GITHUB_OUTPUT |
| 121 | + echo "SOLUNA_BINARY=$RENAME_BINARY" >> $GITHUB_OUTPUT |
67 | 122 | - uses: actions/upload-artifact@v4 |
68 | 123 | name: Upload |
69 | 124 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' |
|
74 | 129 | overwrite: "true" |
75 | 130 | release: |
76 | 131 | name: Create Nightly Release |
77 | | - needs: build |
| 132 | + needs: [check, build] |
78 | 133 | runs-on: ubuntu-latest |
79 | 134 | if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' |
80 | 135 | permissions: |
@@ -141,8 +196,8 @@ jobs: |
141 | 196 | - **Workflow:** [${context.runId}](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) |
142 | 197 |
|
143 | 198 | **Assets:** |
144 | | - - soluna-Windows-soluna.exe |
145 | | - - soluna-macOS-soluna |
| 199 | + - soluna-windows-amd64.exe |
| 200 | + - soluna-macos-arm64 |
146 | 201 |
|
147 | 202 | > ⚠️ **Note:** This is an automated nightly build. It may contain unstable features and bugs. |
148 | 203 | > |
|
0 commit comments