mirror of
https://github.com/goreleaser/goreleaser-action.git
synced 2026-05-14 23:00:33 +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:
parent
6606af0cbb
commit
482db5f7c3
3 changed files with 22 additions and 6 deletions
|
|
@ -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', () => {
|
||||
expect(goreleaser.getCertificateIdentity('goreleaser', 'v2.16.0-abc1234-nightly')).toEqual(
|
||||
'https://github.com/goreleaser/goreleaser/.github/workflows/nightly-oss.yml@refs/heads/main'
|
||||
|
|
|
|||
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -34,7 +34,7 @@ export interface GitHubRelease {
|
|||
export const nightlyTagRegex = /^v\d+\.\d+\.\d+-[0-9a-f]+-nightly$/i;
|
||||
|
||||
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> => {
|
||||
|
|
@ -114,11 +114,15 @@ const resolveNightly = async (distribution: string): Promise<GitHubRelease> => {
|
|||
});
|
||||
|
||||
const match = releases.find(r => nightlyTagRegex.test(r.tag_name));
|
||||
if (!match) {
|
||||
throw new Error(`No '<version>-<sha>-nightly' release found in ${url}`);
|
||||
if (match) {
|
||||
core.info(`Resolved nightly to ${match.tag_name}`);
|
||||
return match;
|
||||
}
|
||||
core.info(`Resolved nightly to ${match.tag_name}`);
|
||||
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> => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue