Skip to content

Commit 7dabbad

Browse files
committed
cleaner build instructions
1 parent cdd53b5 commit 7dabbad

File tree

1 file changed

+9
-57
lines changed

1 file changed

+9
-57
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
description: "The tag name of the MinIO release to build (e.g., RELEASE.2023-05-04T21-44-30Z)"
1010
schedule:
1111
# Run weekly at midnight on Sunday
12-
- cron: '*/15 * * * *'
12+
- cron: '0 0 * * *'
1313

1414
env:
1515
IMAGE: 'proof-partners/minio'
@@ -20,13 +20,13 @@ permissions:
2020
packages: write
2121

2222
jobs:
23-
check-latest-release:
23+
get-tags:
2424
runs-on: ubuntu-latest
2525
# Only run this job if triggered by the schedule, not manually
2626
if: github.event_name == 'schedule'
2727
outputs:
2828
latest_release: ${{ steps.get-latest-release.outputs.latest_release }}
29-
should_run: ${{ steps.check-new-release.outputs.should_run }}
29+
previous_build: ${{ steps.get-latest-build.outputs.previous_build }}
3030
steps:
3131
- name: Get latest release
3232
id: get-latest-release
@@ -43,65 +43,17 @@ jobs:
4343
ENCODED_TOKEN=$(echo -n "${{ secrets.GITHUB_TOKEN }}" | base64)
4444
TAG=$(curl -s -H "Authorization: Bearer ${ENCODED_TOKEN}" "https://ghcr.io/v2/${IMAGE}/tags/list" \
4545
| jq '.tags[]' | sed -E 's/^.+(RELEASE\..+)"$/\1/' | awk '/RELEASE/' | sort | tail -n 1)
46-
echo "${IMAGE}: ${TAG}"
46+
echo "previous_build=${TAG}" >> $GITHUB_OUTPUT
47+
echo "Previous build: ${TAG}"
4748
48-
- name: Check if this is a new release
49-
id: check-new-release
50-
uses: actions/github-script@v7
51-
with:
52-
github-token: ${{ secrets.GITHUB_TOKEN }}
53-
script: |
54-
// We'll use GitHub repository variable to store the last processed release
55-
// First, try to get the current value of the variable
56-
let lastProcessed;
57-
try {
58-
const { data: variable } = await github.rest.actions.getRepoVariable({
59-
owner: context.repo.owner,
60-
repo: context.repo.repo,
61-
name: 'LAST_MINIO_RELEASE'
62-
});
63-
lastProcessed = variable.value;
64-
console.log(`Last processed release: ${lastProcessed}`);
65-
} catch (error) {
66-
console.log('Variable not found or first run, will create it');
67-
lastProcessed = '';
68-
}
69-
70-
const latestRelease = '${{ steps.get-latest-release.outputs.latest_release }}';
71-
console.log(`Latest release: ${latestRelease}`);
72-
73-
// Check if this is a new release
74-
let shouldRun = false;
75-
if (latestRelease !== lastProcessed) {
76-
console.log('New release detected!');
77-
shouldRun = true;
78-
79-
// Update the variable with the latest release
80-
try {
81-
await github.rest.actions.updateRepoVariable({
82-
owner: context.repo.owner,
83-
repo: context.repo.repo,
84-
name: 'LAST_MINIO_RELEASE',
85-
value: latestRelease
86-
});
87-
console.log('Updated LAST_MINIO_RELEASE variable');
88-
} catch (error) {
89-
console.log('Error updating variable:', error);
90-
// Still run the workflow even if variable update fails
91-
}
92-
} else {
93-
console.log('No new release. Skipping build.');
94-
}
95-
96-
// Set output parameters
97-
core.setOutput('should_run', shouldRun.toString());
9849
build:
9950
# For manual runs, run directly
10051
# For scheduled runs, only run if check-latest-release determined there's a new release
101-
needs: [check-latest-release]
52+
needs: [get-tags]
10253
if: >
10354
github.event_name == 'workflow_dispatch' ||
104-
(github.event_name == 'schedule' && needs.check-latest-release.outputs.should_run == 'true')
55+
(github.event_name == 'schedule' &&
56+
needs.get-tags.outputs.latest-release != needs.get-tags.outputs.previous_build)
10557
strategy:
10658
matrix:
10759
OS: [linux, windows]
@@ -117,7 +69,7 @@ jobs:
11769
- name: Set VERSION env var
11870
run: |
11971
if [ "${{ github.event_name }}" == "schedule" ]; then
120-
echo "VERSION=${{ needs.check-latest-release.outputs.latest_release }}" >> $GITHUB_ENV
72+
echo "VERSION=${{ needs.get-tags.outputs.latest_release }}" >> $GITHUB_ENV
12173
echo "Using latest version: ${{ needs.check-latest-release.outputs.latest_release }}"
12274
else
12375
echo "Using manually specified version: ${{ github.event.inputs.release }}"

0 commit comments

Comments
 (0)