Skip to content

Commit

Permalink
feat!: remove auto-snapshot on dirty tag (#382)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
caarlos0 authored Dec 13, 2022
1 parent 23e0ed5 commit 3b7d1ba
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 126 deletions.
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

0 comments on commit 3b7d1ba

Please sign in to comment.