mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-07-10 15:37:31 +00:00
feat: keep legacy 'nightly' tag working during transition
Fall back to the moving 'nightly' tag when no immutable vX.Y.Z-<sha>-nightly release is found, so the action keeps working between this release and the goreleaser nightly switchover. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -104,6 +104,18 @@ describe('getCertificateIdentity', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('uses nightly-oss.yml@refs/heads/main for OSS legacy nightly tag', () => {
|
||||||
|
expect(goreleaser.getCertificateIdentity('goreleaser', 'nightly')).toEqual(
|
||||||
|
'https://github.com/goreleaser/goreleaser/.github/workflows/nightly-oss.yml@refs/heads/main'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('uses nightly-pro.yml@refs/heads/main for Pro legacy nightly tag', () => {
|
||||||
|
expect(goreleaser.getCertificateIdentity('goreleaser-pro', 'nightly')).toEqual(
|
||||||
|
'https://github.com/goreleaser/goreleaser-pro-internal/.github/workflows/nightly-pro.yml@refs/heads/main'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('uses nightly-oss.yml@refs/heads/main for OSS nightly tag', () => {
|
it('uses nightly-oss.yml@refs/heads/main for OSS nightly tag', () => {
|
||||||
expect(goreleaser.getCertificateIdentity('goreleaser', 'v2.16.0-abc1234-nightly')).toEqual(
|
expect(goreleaser.getCertificateIdentity('goreleaser', 'v2.16.0-abc1234-nightly')).toEqual(
|
||||||
'https://github.com/goreleaser/goreleaser/.github/workflows/nightly-oss.yml@refs/heads/main'
|
'https://github.com/goreleaser/goreleaser/.github/workflows/nightly-oss.yml@refs/heads/main'
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+8
-4
@@ -34,7 +34,7 @@ export interface GitHubRelease {
|
|||||||
export const nightlyTagRegex = /^v\d+\.\d+\.\d+-[0-9a-f]+-nightly$/i;
|
export const nightlyTagRegex = /^v\d+\.\d+\.\d+-[0-9a-f]+-nightly$/i;
|
||||||
|
|
||||||
export const isNightlyTag = (tag: string): boolean => {
|
export const isNightlyTag = (tag: string): boolean => {
|
||||||
return nightlyTagRegex.test(tag);
|
return tag === 'nightly' || nightlyTagRegex.test(tag);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
|
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
|
||||||
@@ -114,11 +114,15 @@ const resolveNightly = async (distribution: string): Promise<GitHubRelease> => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const match = releases.find(r => nightlyTagRegex.test(r.tag_name));
|
const match = releases.find(r => nightlyTagRegex.test(r.tag_name));
|
||||||
if (!match) {
|
if (match) {
|
||||||
throw new Error(`No '<version>-<sha>-nightly' release found in ${url}`);
|
|
||||||
}
|
|
||||||
core.info(`Resolved nightly to ${match.tag_name}`);
|
core.info(`Resolved nightly to ${match.tag_name}`);
|
||||||
return match;
|
return match;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback to the legacy moving `nightly` tag during the transition period,
|
||||||
|
// until goreleaser stops publishing it.
|
||||||
|
core.warning(`No '<version>-<sha>-nightly' release found in ${url}, falling back to 'nightly' tag`);
|
||||||
|
return {tag_name: 'nightly'};
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user