Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into flarco/master
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos A Becker <[email protected]>
  • Loading branch information
caarlos0 committed Dec 13, 2022
2 parents 1315dab + 3c08cfd commit 66134d9
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 145 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ purpose. You can do that with the [actions/upload-artifact](https://github.com/a
with:
version: latest
args: release --rm-dist
workdir: myfolder
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Upload assets
uses: actions/upload-artifact@v3
with:
name: myapp
path: dist/*
path: myfolder/dist/*
```

### Install Only
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@actions/http-client": "^2.0.1",
"@actions/tool-cache": "^2.0.1",
"js-yaml": "^4.1.0",
"yargs": "^17.6.0"
"yargs": "^17.6.2"
},
"devDependencies": {
"@types/node": "^16.11.26",
Expand Down
49 changes: 0 additions & 49 deletions src/git.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/goreleaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export async function install(distribution: string, version: string): Promise<st
core.info('Extracting GoReleaser');
let extPath: string;
if (context.osPlat == 'win32') {
if(!downloadPath.endsWith('.zip')) {
let newPath = downloadPath + '.zip';
if (!downloadPath.endsWith('.zip')) {
const newPath = downloadPath + '.zip';
fs.renameSync(downloadPath, newPath);
extPath = await tc.extractZip(newPath);
} else {
Expand Down
25 changes: 1 addition & 24 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,25 +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}`, undefined, {
env: Object.assign({}, process.env, {
GORELEASER_CURRENT_TAG: process.env.GORELEASER_CURRENT_TAG || tag || ''
}) as {
[key: string]: string;
}
});
await exec.exec(`${bin} ${inputs.args}`);

if (typeof yamlfile === 'string') {
const artifacts = await goreleaser.getArtifacts(await goreleaser.getDistPath(yamlfile));
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3558,10 +3558,10 @@ [email protected], yargs-parser@^20.2.2:
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==

yargs-parser@^21.0.0:
version "21.0.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35"
integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==
yargs-parser@^21.1.1:
version "21.1.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==

yargs@^16.2.0:
version "16.2.0"
Expand All @@ -3576,18 +3576,18 @@ yargs@^16.2.0:
y18n "^5.0.5"
yargs-parser "^20.2.2"

yargs@^17.6.0:
version "17.6.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.0.tgz#e134900fc1f218bc230192bdec06a0a5f973e46c"
integrity sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==
yargs@^17.6.2:
version "17.6.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541"
integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==
dependencies:
cliui "^8.0.1"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.3"
y18n "^5.0.5"
yargs-parser "^21.0.0"
yargs-parser "^21.1.1"

[email protected]:
version "3.1.1"
Expand Down

0 comments on commit 66134d9

Please sign in to comment.