Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove auto-snapshot on dirty tag #382

Merged
merged 5 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
with:
distribution: ${{ matrix.distribution }}
version: ${{ matrix.version }}
args: release --skip-publish --rm-dist
args: release --skip-publish --rm-dist --snapshot
workdir: ./test

install-only:
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
uses: ./
with:
version: latest
args: -f .goreleaser-signing.yml release --skip-publish --rm-dist
args: -f .goreleaser-signing.yml release --skip-publish --rm-dist --snapshot
workdir: ./test
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
name: GoReleaser
uses: ./
with:
args: release --skip-publish --rm-dist
args: release --skip-publish --rm-dist --snapshot
workdir: ./test
-
name: Upload assets
Expand All @@ -175,28 +175,6 @@ jobs:
name: myapp
path: ./test/dist/*

current-tag:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
-
name: GoReleaser
uses: ./
with:
args: release --skip-publish --rm-dist
workdir: ./test
env:
GORELEASER_CURRENT_TAG: v99.99.99

dist:
runs-on: ubuntu-latest
steps:
Expand All @@ -214,7 +192,7 @@ jobs:
name: GoReleaser
uses: ./
with:
args: release --config .goreleaser-dist.yml --skip-publish --rm-dist
args: release --config .goreleaser-dist.yml --skip-publish --rm-dist --snapshot
workdir: ./test
-
name: Check dist
Expand Down
31 changes: 0 additions & 31 deletions __tests__/git.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

49 changes: 0 additions & 49 deletions src/git.ts

This file was deleted.

19 changes: 1 addition & 18 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as fs from 'fs';
import * as path from 'path';
import yargs from 'yargs';
import * as context from './context';
import * as git from './git';
import * as goreleaser from './goreleaser';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
Expand All @@ -28,10 +27,6 @@ async function run(): Promise<void> {
process.chdir(inputs.workdir);
}

const commit = await git.getShortCommit();
const tag = await git.getTag();
const isTagDirty = await git.isTagDirty(tag);

let yamlfile: string | unknown;
const argv = yargs.parse(inputs.args);
if (argv.config) {
Expand All @@ -44,19 +39,7 @@ async function run(): Promise<void> {
});
}

let snapshot = '';
if (inputs.args.split(' ').indexOf('release') > -1) {
if (isTagDirty) {
if (!inputs.args.includes('--snapshot') && !inputs.args.includes('--nightly')) {
core.info(`No tag found for commit ${commit}. Snapshot forced`);
snapshot = ' --snapshot';
}
} else {
core.info(`${tag} tag found for commit ${commit}`);
}
}

await exec.exec(`${bin} ${inputs.args}${snapshot}`);
await exec.exec(`${bin} ${inputs.args}`);

if (typeof yamlfile === 'string') {
const artifacts = await goreleaser.getArtifacts(await goreleaser.getDistPath(yamlfile));
Expand Down