Skip to content

Commit 3b7d1ba

Browse files
authored
feat!: remove auto-snapshot on dirty tag (#382)
* feat!: remove auto-snapshot on dirty tag Signed-off-by: Carlos A Becker <[email protected]> * feat!: remove the entire git thing Signed-off-by: Carlos A Becker <[email protected]> * fix: tests Signed-off-by: Carlos A Becker <[email protected]> * test: fix Signed-off-by: Carlos A Becker <[email protected]> * fix: snapshto tests Signed-off-by: Carlos A Becker <[email protected]> Signed-off-by: Carlos A Becker <[email protected]>
1 parent 23e0ed5 commit 3b7d1ba

File tree

6 files changed

+7
-126
lines changed

6 files changed

+7
-126
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
distribution: ${{ matrix.distribution }}
5959
version: ${{ matrix.version }}
60-
args: release --skip-publish --rm-dist
60+
args: release --skip-publish --rm-dist --snapshot
6161
workdir: ./test
6262

6363
install-only:
@@ -138,7 +138,7 @@ jobs:
138138
uses: ./
139139
with:
140140
version: latest
141-
args: -f .goreleaser-signing.yml release --skip-publish --rm-dist
141+
args: -f .goreleaser-signing.yml release --skip-publish --rm-dist --snapshot
142142
workdir: ./test
143143
env:
144144
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
@@ -166,7 +166,7 @@ jobs:
166166
name: GoReleaser
167167
uses: ./
168168
with:
169-
args: release --skip-publish --rm-dist
169+
args: release --skip-publish --rm-dist --snapshot
170170
workdir: ./test
171171
-
172172
name: Upload assets
@@ -175,28 +175,6 @@ jobs:
175175
name: myapp
176176
path: ./test/dist/*
177177

178-
current-tag:
179-
runs-on: ubuntu-latest
180-
steps:
181-
-
182-
name: Checkout
183-
uses: actions/checkout@v3
184-
with:
185-
fetch-depth: 0
186-
-
187-
name: Set up Go
188-
uses: actions/setup-go@v3
189-
with:
190-
go-version: 1.18
191-
-
192-
name: GoReleaser
193-
uses: ./
194-
with:
195-
args: release --skip-publish --rm-dist
196-
workdir: ./test
197-
env:
198-
GORELEASER_CURRENT_TAG: v99.99.99
199-
200178
dist:
201179
runs-on: ubuntu-latest
202180
steps:
@@ -214,7 +192,7 @@ jobs:
214192
name: GoReleaser
215193
uses: ./
216194
with:
217-
args: release --config .goreleaser-dist.yml --skip-publish --rm-dist
195+
args: release --config .goreleaser-dist.yml --skip-publish --rm-dist --snapshot
218196
workdir: ./test
219197
-
220198
name: Check dist

__tests__/git.test.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/git.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/main.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as fs from 'fs';
22
import * as path from 'path';
33
import yargs from 'yargs';
44
import * as context from './context';
5-
import * as git from './git';
65
import * as goreleaser from './goreleaser';
76
import * as core from '@actions/core';
87
import * as exec from '@actions/exec';
@@ -28,10 +27,6 @@ async function run(): Promise<void> {
2827
process.chdir(inputs.workdir);
2928
}
3029

31-
const commit = await git.getShortCommit();
32-
const tag = await git.getTag();
33-
const isTagDirty = await git.isTagDirty(tag);
34-
3530
let yamlfile: string | unknown;
3631
const argv = yargs.parse(inputs.args);
3732
if (argv.config) {
@@ -44,19 +39,7 @@ async function run(): Promise<void> {
4439
});
4540
}
4641

47-
let snapshot = '';
48-
if (inputs.args.split(' ').indexOf('release') > -1) {
49-
if (isTagDirty) {
50-
if (!inputs.args.includes('--snapshot') && !inputs.args.includes('--nightly')) {
51-
core.info(`No tag found for commit ${commit}. Snapshot forced`);
52-
snapshot = ' --snapshot';
53-
}
54-
} else {
55-
core.info(`${tag} tag found for commit ${commit}`);
56-
}
57-
}
58-
59-
await exec.exec(`${bin} ${inputs.args}${snapshot}`);
42+
await exec.exec(`${bin} ${inputs.args}`);
6043

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

0 commit comments

Comments
 (0)