refactor: drop legacy 'nightly' tag fallback

Both goreleaser and goreleaser-pro now publish nightly releases as
vX.Y.Z-<sha>-nightly, so the action no longer needs to special-case
or fall back to the moving 'nightly' tag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker 2026-04-26 18:02:55 -03:00
parent 4c6ab561ad
commit a71152e827
No known key found for this signature in database
4 changed files with 8 additions and 26 deletions

View file

@ -56,12 +56,10 @@ describe('getRelease', () => {
expect(release?.tag_name).not.toEqual('');
});
it('resolves nightly to the legacy nightly tag for OSS GoReleaser', async () => {
// No <version>-<sha>-nightly release exists in goreleaser/goreleaser yet,
// so this should fall back to the legacy moving `nightly` tag.
it('resolves nightly to a <version>-<sha>-nightly release for OSS GoReleaser', async () => {
const release = await github.getRelease('goreleaser', 'nightly');
expect(release).not.toBeNull();
expect(release.tag_name).toEqual('nightly');
expect(release.tag_name).toMatch(github.nightlyTagRegex);
});
it('resolves nightly to a <version>-<sha>-nightly release for GoReleaser Pro', async () => {

View file

@ -104,18 +104,6 @@ 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

File diff suppressed because one or more lines are too long

View file

@ -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 tag === 'nightly' || nightlyTagRegex.test(tag);
return nightlyTagRegex.test(tag);
};
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
@ -114,15 +114,11 @@ const resolveNightly = async (distribution: string): Promise<GitHubRelease> => {
});
const match = releases.find(r => nightlyTagRegex.test(r.tag_name));
if (match) {
core.info(`Resolved nightly to ${match.tag_name}`);
return match;
if (!match) {
throw new Error(`No '<version>-<sha>-nightly' release found in ${url}`);
}
// 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'};
core.info(`Resolved nightly to ${match.tag_name}`);
return match;
};
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {