Skip to content

Commit f09d69b

Browse files
committed
feat(workflow): Add aarch64 build and skip version check on manual trigger
1 parent f829a8b commit f09d69b

File tree

1 file changed

+37
-29
lines changed

1 file changed

+37
-29
lines changed

.github/workflows/docker-publish.yml

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,41 @@ jobs:
3737
const packageVersion = "${{ steps.get_version.outputs.version }}";
3838
console.log(`Package version: ${packageVersion}`);
3939
40-
try {
41-
const latestRelease = await github.rest.repos.getLatestRelease({
42-
owner: context.repo.owner,
43-
repo: context.repo.repo,
44-
});
45-
46-
const latestTag = latestRelease.data.tag_name;
47-
console.log(`Latest release tag: ${latestTag}`);
48-
49-
// Assuming tag is like 'v1.2.3', remove 'v' prefix
50-
const latestVersion = latestTag.startsWith('v') ? latestTag.substring(1) : latestTag;
51-
console.log(`Latest release version: ${latestVersion}`);
52-
53-
if (packageVersion !== latestVersion) {
54-
console.log('Version mismatch. Build needed.');
55-
core.setOutput('needs_build', 'true');
56-
} else {
57-
console.log('Versions match. No build needed.');
58-
core.setOutput('needs_build', 'false');
59-
}
60-
} catch (error) {
61-
// Handle case where no releases exist yet or API error
62-
if (error.status === 404) {
63-
console.log('No releases found. Build needed.');
64-
core.setOutput('needs_build', 'true');
65-
} else {
66-
console.error('Error fetching latest release:', error);
67-
core.setFailed(`Error fetching latest release: ${error.message}`);
68-
core.setOutput('needs_build', 'false'); // Don't build on error
40+
if (context.eventName === 'workflow_dispatch') {
41+
console.log('Manual trigger detected. Skipping version check and forcing build.');
42+
core.setOutput('needs_build', 'true');
43+
} else {
44+
console.log('Push trigger detected. Comparing package version with latest release tag.');
45+
try {
46+
const latestRelease = await github.rest.repos.getLatestRelease({
47+
owner: context.repo.owner,
48+
repo: context.repo.repo,
49+
});
50+
51+
const latestTag = latestRelease.data.tag_name;
52+
console.log(`Latest release tag: ${latestTag}`);
53+
54+
// Assuming tag is like 'v1.2.3', remove 'v' prefix
55+
const latestVersion = latestTag.startsWith('v') ? latestTag.substring(1) : latestTag;
56+
console.log(`Latest release version: ${latestVersion}`);
57+
58+
if (packageVersion !== latestVersion) {
59+
console.log('Version mismatch. Build needed.');
60+
core.setOutput('needs_build', 'true');
61+
} else {
62+
console.log('Versions match. No build needed.');
63+
core.setOutput('needs_build', 'false');
64+
}
65+
} catch (error) {
66+
// Handle case where no releases exist yet or API error
67+
if (error.status === 404) {
68+
console.log('No releases found. Build needed.');
69+
core.setOutput('needs_build', 'true');
70+
} else {
71+
console.error('Error fetching latest release:', error);
72+
core.setFailed(`Error fetching latest release: ${error.message}`);
73+
core.setOutput('needs_build', 'false'); // Don't build on error
74+
}
6975
}
7076
}
7177
@@ -96,6 +102,7 @@ jobs:
96102
uses: docker/build-push-action@v5
97103
with:
98104
context: .
105+
platforms: linux/amd64,linux/aarch64
99106
# Dockerfile already modified by "Append ENTRYPOINT..." step for standalone
100107
push: true
101108
tags: |
@@ -110,6 +117,7 @@ jobs:
110117
uses: docker/build-push-action@v5
111118
with:
112119
context: .
120+
platforms: linux/amd64,linux/aarch64
113121
# Dockerfile already modified by "Append ENTRYPOINT..." step for standalone
114122
push: true
115123
tags: |

0 commit comments

Comments
 (0)