mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-31 12:48:28 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac067437f5 | ||
|
|
bbb1d19f5b | ||
|
|
d0c4a003d3 | ||
|
|
c2b33cd784 | ||
|
|
35d40269d0 | ||
|
|
be642f174c | ||
|
|
d401a5332a | ||
|
|
70eb4e573c | ||
|
|
a3b2f49e7c | ||
|
|
8571fa911c | ||
|
|
a604a9b2f7 | ||
|
|
239f064349 | ||
|
|
ab4f17620b | ||
|
|
15c488ce8f | ||
|
|
f08023819a | ||
|
|
4921ce3062 | ||
|
|
6b584eeb7a |
@@ -26,7 +26,10 @@ jobs:
|
|||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
- latest
|
- latest
|
||||||
- v0.145.0
|
- '~> 0.166'
|
||||||
|
distribution:
|
||||||
|
- goreleaser
|
||||||
|
- goreleaser-pro
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
@@ -37,7 +40,7 @@ jobs:
|
|||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version: 1.16
|
||||||
-
|
-
|
||||||
name: Check
|
name: Check
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -47,8 +50,12 @@ jobs:
|
|||||||
workdir: ./test
|
workdir: ./test
|
||||||
-
|
-
|
||||||
name: GoReleaser
|
name: GoReleaser
|
||||||
|
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
||||||
uses: ./
|
uses: ./
|
||||||
|
env:
|
||||||
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||||
with:
|
with:
|
||||||
|
distribution: ${{ matrix.distribution }}
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
args: release --skip-publish --rm-dist
|
args: release --skip-publish --rm-dist
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
@@ -60,7 +67,10 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
version:
|
version:
|
||||||
- latest
|
- latest
|
||||||
- v0.145.0
|
- '~> 0.166'
|
||||||
|
distribution:
|
||||||
|
- goreleaser
|
||||||
|
- goreleaser-pro
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
@@ -71,15 +81,18 @@ jobs:
|
|||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version: 1.16
|
||||||
-
|
-
|
||||||
name: GoReleaser
|
name: GoReleaser
|
||||||
|
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
distribution: ${{ matrix.distribution }}
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
install-only: true
|
install-only: true
|
||||||
-
|
-
|
||||||
name: Check
|
name: Check
|
||||||
|
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
||||||
run: |
|
run: |
|
||||||
goreleaser check --debug
|
goreleaser check --debug
|
||||||
|
|
||||||
@@ -103,7 +116,7 @@ jobs:
|
|||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version: 1.16
|
||||||
-
|
-
|
||||||
name: Import GPG key
|
name: Import GPG key
|
||||||
id: import_gpg
|
id: import_gpg
|
||||||
@@ -142,7 +155,7 @@ jobs:
|
|||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version: 1.16
|
||||||
-
|
-
|
||||||
name: Check
|
name: Check
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
-132
@@ -1,132 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## 2.5.0 (2021/03/31)
|
|
||||||
|
|
||||||
* Bump y18n from 4.0.0 to 4.0.1 (#272)
|
|
||||||
* Bump @actions/http-client from 1.0.9 to 1.0.11 (#270)
|
|
||||||
* Enhance workflow (#271)
|
|
||||||
* Bump node-notifier from 8.0.0 to 8.0.1 (#263)
|
|
||||||
|
|
||||||
## 2.4.1 (2020/12/02)
|
|
||||||
|
|
||||||
* Do not overwrite GORELEASER_CURRENT_TAG if already declared (#260)
|
|
||||||
|
|
||||||
## 2.4.0 (2020/11/30)
|
|
||||||
|
|
||||||
* Set GORELEASER_CURRENT_TAG (#259)
|
|
||||||
* Container based developer flow (#258)
|
|
||||||
* Upload artifact example (#257)
|
|
||||||
* Bump @actions/tool-cache from 1.6.0 to 1.6.1 (#256)
|
|
||||||
|
|
||||||
## 2.3.0 (2020/11/06)
|
|
||||||
|
|
||||||
* Add install-only option for using goreleaser in user scripts (#252)
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 2.2.1 (2020/10/01)
|
|
||||||
|
|
||||||
* Fix CVE-2020-15228
|
|
||||||
|
|
||||||
## 2.2.0 (2020/08/27)
|
|
||||||
|
|
||||||
* Use GITHUB_REF to retrieve tag before checking the most recent tag (#238)
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 2.1.1 (2020/06/24)
|
|
||||||
|
|
||||||
* Fix workdir (#224)
|
|
||||||
|
|
||||||
## 2.1.0 (2020/06/15)
|
|
||||||
|
|
||||||
* Implement (optional) semver parsing of version (#213)
|
|
||||||
* Remove unshallow step (goreleaser/goreleaser#1608)
|
|
||||||
|
|
||||||
## 2.0.2 (2020/05/10)
|
|
||||||
|
|
||||||
* Use template in `sign.args`
|
|
||||||
|
|
||||||
## 2.0.1 (2020/05/10)
|
|
||||||
|
|
||||||
* Dummy release to mark v2 as latest on the marketplace
|
|
||||||
|
|
||||||
## 2.0.0 (2020/05/10)
|
|
||||||
|
|
||||||
* Remove `key` input and use [Import GPG](https://github.com/crazy-max/ghaction-import-gpg) GitHub Action instead.
|
|
||||||
* Make `args` input as required
|
|
||||||
* Go 1.14
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 1.5.1 (2020/05/10)
|
|
||||||
|
|
||||||
* Mark `key` input as deprecated
|
|
||||||
|
|
||||||
## 1.5.0 (2020/05/07)
|
|
||||||
|
|
||||||
* Use native GitHub Action tools to download assets and use GitHub API
|
|
||||||
* Fix unexpected output when tag not found
|
|
||||||
* Use GitHub Action exec
|
|
||||||
* Cleanup local paths from extra fields
|
|
||||||
* Add notes about limitation with GITHUB_TOKEN (#58)
|
|
||||||
* Add Codecov
|
|
||||||
|
|
||||||
## 1.4.0 (2020/04/09)
|
|
||||||
|
|
||||||
* Use ncc and clean workflows
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 1.3.1 (2020/02/14)
|
|
||||||
|
|
||||||
* Don't fail on `getTag` (#98)
|
|
||||||
|
|
||||||
## 1.3.0 (2020/02/11)
|
|
||||||
|
|
||||||
* Improve git tag detection (#77)
|
|
||||||
* Only handle snapshot flag for release cmd (#94)
|
|
||||||
* Use `core.info` instead of `console.log`
|
|
||||||
* Update deps
|
|
||||||
* Update gitattributes
|
|
||||||
|
|
||||||
## 1.2.1 (2020/01/20)
|
|
||||||
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 1.2.0 (2019/12/24)
|
|
||||||
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 1.1.0 (2019/12/02)
|
|
||||||
|
|
||||||
* Add input to run GoReleaser from a subdirectory (#45)
|
|
||||||
|
|
||||||
## 1.0.2 (2019/11/14)
|
|
||||||
|
|
||||||
* Fix tsc gen
|
|
||||||
|
|
||||||
## 1.0.1 (2019/11/14)
|
|
||||||
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 1.0.0 (2019/10/04)
|
|
||||||
|
|
||||||
* Stable release
|
|
||||||
* Update deps
|
|
||||||
|
|
||||||
## 0.4.0 (2019/09/28)
|
|
||||||
|
|
||||||
* Move repository to GoReleaser org (#3)
|
|
||||||
|
|
||||||
## 0.3.0 (2019/09/26)
|
|
||||||
|
|
||||||
* Artifact signing (#2)
|
|
||||||
|
|
||||||
## 0.2.1 (2019/09/22)
|
|
||||||
|
|
||||||
* Typo
|
|
||||||
|
|
||||||
## 0.2.0 (2019/09/20)
|
|
||||||
|
|
||||||
* Snapshot forced if no tag found
|
|
||||||
|
|
||||||
## 0.1.0 (2019/09/20)
|
|
||||||
|
|
||||||
* Initial version
|
|
||||||
@@ -57,10 +57,14 @@ jobs:
|
|||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: goreleaser/goreleaser-action@v2
|
||||||
with:
|
with:
|
||||||
|
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||||
|
distribution: goreleaser
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --rm-dist
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
|
||||||
|
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||||
```
|
```
|
||||||
|
|
||||||
> **IMPORTANT**: note the `fetch-depth: 0` input in `Checkout` step. It is required for the changelog to work correctly.
|
> **IMPORTANT**: note the `fetch-depth: 0` input in `Checkout` step. It is required for the changelog to work correctly.
|
||||||
@@ -165,12 +169,13 @@ steps:
|
|||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|------------------|---------|-----------|-------------------------------------------|
|
|------------------|---------|--------------|------------------------------------------------------------------|
|
||||||
| `version`**¹** | String | `latest` | GoReleaser version |
|
| `distribution` | String | `goreleaser` | GoReleaser distribution, either `goreleaser` or `goreleaser-pro` |
|
||||||
| `args` | String | | Arguments to pass to GoReleaser |
|
| `version`**¹** | String | `latest` | GoReleaser version |
|
||||||
| `workdir` | String | `.` | Working directory (below repository root) |
|
| `args` | String | | Arguments to pass to GoReleaser |
|
||||||
| `install-only` | Bool | `false` | Just install GoReleaser |
|
| `workdir` | String | `.` | Working directory (below repository root) |
|
||||||
|
| `install-only` | Bool | `false` | Just install GoReleaser |
|
||||||
|
|
||||||
> **¹** Can be a fixed version like `v0.117.0` or a max satisfying semver one like `~> 0.132`. In this case this will return `v0.132.1`.
|
> **¹** Can be a fixed version like `v0.117.0` or a max satisfying semver one like `~> 0.132`. In this case this will return `v0.132.1`.
|
||||||
|
|
||||||
@@ -178,17 +183,18 @@ Following inputs can be used as `step.with` keys
|
|||||||
|
|
||||||
Following environment variables can be used as `step.env` keys
|
Following environment variables can be used as `step.env` keys
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|----------------|---------------------------------------|
|
|------------------|---------------------------------------|
|
||||||
| `GITHUB_TOKEN` | [GITHUB_TOKEN](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) as provided by `secrets` |
|
| `GITHUB_TOKEN` | [GITHUB_TOKEN](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) as provided by `secrets` |
|
||||||
|
| `GORELEASER_KEY` | Your [GoReleaser Pro](https://goreleaser.com/pro) License Key, in case you are using the `goreleaser-pro` distribution |
|
||||||
|
|
||||||
## Limitation
|
## Limitation
|
||||||
|
|
||||||
`GITHUB_TOKEN` permissions [are limited to the repository](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#about-the-github_token-secret)
|
`GITHUB_TOKEN` permissions [are limited to the repository](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#about-the-github_token-secret)
|
||||||
that contains your workflow.
|
that contains your workflow.
|
||||||
|
|
||||||
If you need to push the homebrew tap to another repository, you must therefore create a custom [Personal Access Token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
|
If you need to push the homebrew tap to another repository, you must therefore create a custom [Personal Access Token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
|
||||||
with `repo` permissions and [add it as a secret in the repository](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets). If you create a
|
with `repo` permissions and [add it as a secret in the repository](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets). If you create a
|
||||||
secret named `GH_PAT`, the step will look like this:
|
secret named `GH_PAT`, the step will look like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -2,19 +2,33 @@ import * as github from '../src/github';
|
|||||||
|
|
||||||
describe('github', () => {
|
describe('github', () => {
|
||||||
it('returns latest GoReleaser GitHub release', async () => {
|
it('returns latest GoReleaser GitHub release', async () => {
|
||||||
const release = await github.getRelease('latest');
|
const release = await github.getRelease('goreleaser', 'latest');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).not.toEqual('');
|
expect(release?.tag_name).not.toEqual('');
|
||||||
console.log(`tag_name: ${release?.tag_name}`);
|
|
||||||
});
|
});
|
||||||
it('returns v0.117.0 GoReleaser GitHub release', async () => {
|
it('returns v0.117.0 GoReleaser GitHub release', async () => {
|
||||||
const release = await github.getRelease('v0.117.0');
|
const release = await github.getRelease('goreleaser', 'v0.117.0');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).toEqual('v0.117.0');
|
expect(release?.tag_name).toEqual('v0.117.0');
|
||||||
});
|
});
|
||||||
it('returns v0.132.1 GoReleaser GitHub release', async () => {
|
it('returns v0.132.1 GoReleaser GitHub release', async () => {
|
||||||
const release = await github.getRelease('~> 0.132');
|
const release = await github.getRelease('goreleaser', '~> 0.132');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).toEqual('v0.132.1');
|
expect(release?.tag_name).toEqual('v0.132.1');
|
||||||
});
|
});
|
||||||
|
it('returns latest GoReleaser Pro GitHub release', async () => {
|
||||||
|
const release = await github.getRelease('goreleaser-pro', 'latest');
|
||||||
|
expect(release).not.toBeNull();
|
||||||
|
expect(release?.tag_name).not.toEqual('');
|
||||||
|
});
|
||||||
|
it('returns v0.166.0-pro GoReleaser Pro GitHub release', async () => {
|
||||||
|
const release = await github.getRelease('goreleaser-pro', 'v0.166.0-pro');
|
||||||
|
expect(release).not.toBeNull();
|
||||||
|
expect(release?.tag_name).toEqual('v0.166.0-pro');
|
||||||
|
});
|
||||||
|
it('returns v0.166.1-pro GoReleaser Pro GitHub release when using semver', async () => {
|
||||||
|
const release = await github.getRelease('goreleaser-pro', '~> 0.166');
|
||||||
|
expect(release).not.toBeNull();
|
||||||
|
expect(release?.tag_name).toEqual('v0.166.1-pro');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,12 +3,22 @@ import * as installer from '../src/installer';
|
|||||||
|
|
||||||
describe('installer', () => {
|
describe('installer', () => {
|
||||||
it('acquires v0.117.0 version of GoReleaser', async () => {
|
it('acquires v0.117.0 version of GoReleaser', async () => {
|
||||||
const goreleaser = await installer.getGoReleaser('v0.117.0');
|
const goreleaser = await installer.getGoReleaser('goreleaser', 'v0.117.0');
|
||||||
expect(fs.existsSync(goreleaser)).toBe(true);
|
expect(fs.existsSync(goreleaser)).toBe(true);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
it('acquires latest version of GoReleaser', async () => {
|
it('acquires latest version of GoReleaser', async () => {
|
||||||
const goreleaser = await installer.getGoReleaser('latest');
|
const goreleaser = await installer.getGoReleaser('goreleaser', 'latest');
|
||||||
|
expect(fs.existsSync(goreleaser)).toBe(true);
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
|
it('acquires v0.166.0-pro version of GoReleaser Pro', async () => {
|
||||||
|
const goreleaser = await installer.getGoReleaser('goreleaser-pro', 'v0.166.0-pro');
|
||||||
|
expect(fs.existsSync(goreleaser)).toBe(true);
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
|
it('acquires latest version of GoReleaser Pro', async () => {
|
||||||
|
const goreleaser = await installer.getGoReleaser('goreleaser-pro', 'latest');
|
||||||
expect(fs.existsSync(goreleaser)).toBe(true);
|
expect(fs.existsSync(goreleaser)).toBe(true);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import * as pro from '../src/pro';
|
||||||
|
|
||||||
|
describe('pro', () => {
|
||||||
|
it('suffixes pro distribution', async () => {
|
||||||
|
expect(pro.suffix('goreleaser-pro')).toEqual('-pro');
|
||||||
|
});
|
||||||
|
it('does not suffix oss distribution', async () => {
|
||||||
|
expect(pro.suffix('goreleaser')).toEqual('');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -7,6 +7,10 @@ branding:
|
|||||||
icon: 'package'
|
icon: 'package'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
|
distribution:
|
||||||
|
description: 'GoReleaser Distribution (goreleaser or goreleaser-pro)'
|
||||||
|
default: 'goreleaser'
|
||||||
|
required: false
|
||||||
version:
|
version:
|
||||||
description: 'GoReleaser version'
|
description: 'GoReleaser version'
|
||||||
default: 'latest'
|
default: 'latest'
|
||||||
|
|||||||
+257
-74
@@ -190,23 +190,30 @@ exports.getRelease = void 0;
|
|||||||
const httpm = __importStar(__webpack_require__(925));
|
const httpm = __importStar(__webpack_require__(925));
|
||||||
const core = __importStar(__webpack_require__(186));
|
const core = __importStar(__webpack_require__(186));
|
||||||
const semver = __importStar(__webpack_require__(911));
|
const semver = __importStar(__webpack_require__(911));
|
||||||
exports.getRelease = (version) => __awaiter(void 0, void 0, void 0, function* () {
|
const pro = __importStar(__webpack_require__(989));
|
||||||
const resolvedVersion = (yield resolveVersion(version)) || version;
|
exports.getRelease = (distribution, version) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const url = `https://github.com/goreleaser/goreleaser/releases/${resolvedVersion}`;
|
const resolvedVersion = (yield resolveVersion(distribution, version)) || version;
|
||||||
|
const url = `https://github.com/goreleaser/${distribution}/releases/${resolvedVersion}`;
|
||||||
const http = new httpm.HttpClient('goreleaser-action');
|
const http = new httpm.HttpClient('goreleaser-action');
|
||||||
return (yield http.getJson(url)).result;
|
return (yield http.getJson(url)).result;
|
||||||
});
|
});
|
||||||
const resolveVersion = (version) => __awaiter(void 0, void 0, void 0, function* () {
|
const resolveVersion = (distribution, version) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const allTags = yield getAllTags();
|
const allTags = yield getAllTags(distribution);
|
||||||
if (!allTags) {
|
if (!allTags) {
|
||||||
throw new Error(`Cannot find GoReleaser tags`);
|
throw new Error(`Cannot find GoReleaser tags`);
|
||||||
}
|
}
|
||||||
core.debug(`Found ${allTags.length} tags in total`);
|
core.debug(`Found ${allTags.length} tags in total`);
|
||||||
return semver.maxSatisfying(allTags, version);
|
if (version === 'latest' || !pro.isPro(distribution)) {
|
||||||
|
return semver.maxSatisfying(allTags, version);
|
||||||
|
}
|
||||||
|
const cleanTags = allTags.map(tag => cleanTag(tag));
|
||||||
|
const cleanVersion = cleanTag(version);
|
||||||
|
return semver.maxSatisfying(cleanTags, cleanVersion) + pro.suffix(distribution);
|
||||||
});
|
});
|
||||||
const getAllTags = () => __awaiter(void 0, void 0, void 0, function* () {
|
const getAllTags = (distribution) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const http = new httpm.HttpClient('goreleaser-action');
|
const http = new httpm.HttpClient('goreleaser-action');
|
||||||
const url = `https://goreleaser.com/static/releases.json`;
|
const suffix = pro.suffix(distribution);
|
||||||
|
const url = `https://goreleaser.com/static/releases${suffix}.json`;
|
||||||
const getTags = http.getJson(url);
|
const getTags = http.getJson(url);
|
||||||
return getTags.then(response => {
|
return getTags.then(response => {
|
||||||
if (response.result == null) {
|
if (response.result == null) {
|
||||||
@@ -215,6 +222,9 @@ const getAllTags = () => __awaiter(void 0, void 0, void 0, function* () {
|
|||||||
return response.result.map(obj => obj.tag_name);
|
return response.result.map(obj => obj.tag_name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const cleanTag = (tag) => {
|
||||||
|
return tag.replace(/-pro$/, '');
|
||||||
|
};
|
||||||
//# sourceMappingURL=github.js.map
|
//# sourceMappingURL=github.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -258,19 +268,20 @@ const os = __importStar(__webpack_require__(87));
|
|||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const util = __importStar(__webpack_require__(669));
|
const util = __importStar(__webpack_require__(669));
|
||||||
const github = __importStar(__webpack_require__(928));
|
const github = __importStar(__webpack_require__(928));
|
||||||
|
const pro = __importStar(__webpack_require__(989));
|
||||||
const core = __importStar(__webpack_require__(186));
|
const core = __importStar(__webpack_require__(186));
|
||||||
const tc = __importStar(__webpack_require__(784));
|
const tc = __importStar(__webpack_require__(784));
|
||||||
const osPlat = os.platform();
|
const osPlat = os.platform();
|
||||||
const osArch = os.arch();
|
const osArch = os.arch();
|
||||||
function getGoReleaser(version) {
|
function getGoReleaser(distribution, version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const release = yield github.getRelease(version);
|
const release = yield github.getRelease(distribution, version);
|
||||||
if (!release) {
|
if (!release) {
|
||||||
throw new Error(`Cannot find GoReleaser ${version} release`);
|
throw new Error(`Cannot find GoReleaser ${version} release`);
|
||||||
}
|
}
|
||||||
core.info(`✅ GoReleaser version found: ${release.tag_name}`);
|
core.info(`✅ GoReleaser version found: ${release.tag_name}`);
|
||||||
const filename = getFilename();
|
const filename = getFilename(distribution);
|
||||||
const downloadUrl = util.format('https://github.com/goreleaser/goreleaser/releases/download/%s/%s', release.tag_name, filename);
|
const downloadUrl = util.format('https://github.com/goreleaser/%s/releases/download/%s/%s', distribution, release.tag_name, filename);
|
||||||
core.info(`⬇️ Downloading ${downloadUrl}...`);
|
core.info(`⬇️ Downloading ${downloadUrl}...`);
|
||||||
const downloadPath = yield tc.downloadTool(downloadUrl);
|
const downloadPath = yield tc.downloadTool(downloadUrl);
|
||||||
core.debug(`Downloaded to ${downloadPath}`);
|
core.debug(`Downloaded to ${downloadPath}`);
|
||||||
@@ -291,11 +302,12 @@ function getGoReleaser(version) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getGoReleaser = getGoReleaser;
|
exports.getGoReleaser = getGoReleaser;
|
||||||
const getFilename = () => {
|
const getFilename = (distribution) => {
|
||||||
const platform = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
|
const platform = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
|
||||||
const arch = osArch == 'x64' ? 'x86_64' : 'i386';
|
const arch = osArch == 'x64' ? 'x86_64' : 'i386';
|
||||||
const ext = osPlat == 'win32' ? 'zip' : 'tar.gz';
|
const ext = osPlat == 'win32' ? 'zip' : 'tar.gz';
|
||||||
return util.format('goreleaser_%s_%s.%s', platform, arch, ext);
|
const suffix = pro.suffix(distribution);
|
||||||
|
return util.format('goreleaser%s_%s_%s.%s', suffix, platform, arch, ext);
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=installer.js.map
|
//# sourceMappingURL=installer.js.map
|
||||||
|
|
||||||
@@ -343,11 +355,12 @@ const path_1 = __webpack_require__(622);
|
|||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
|
const distribution = core.getInput('distribution') || 'goreleaser';
|
||||||
const version = core.getInput('version') || 'latest';
|
const version = core.getInput('version') || 'latest';
|
||||||
const args = core.getInput('args');
|
const args = core.getInput('args');
|
||||||
const workdir = core.getInput('workdir') || '.';
|
const workdir = core.getInput('workdir') || '.';
|
||||||
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
|
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
|
||||||
const goreleaser = yield installer.getGoReleaser(version);
|
const goreleaser = yield installer.getGoReleaser(distribution, version);
|
||||||
core.info(`✅ GoReleaser installed successfully`);
|
core.info(`✅ GoReleaser installed successfully`);
|
||||||
if (isInstallOnly) {
|
if (isInstallOnly) {
|
||||||
const goreleaserDir = path_1.dirname(goreleaser);
|
const goreleaserDir = path_1.dirname(goreleaser);
|
||||||
@@ -393,19 +406,49 @@ run();
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 989:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.isPro = exports.suffix = void 0;
|
||||||
|
exports.suffix = (distribution) => {
|
||||||
|
return exports.isPro(distribution) ? '-pro' : '';
|
||||||
|
};
|
||||||
|
exports.isPro = (distribution) => {
|
||||||
|
return distribution === 'goreleaser-pro';
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=pro.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 241:
|
/***/ 241:
|
||||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
result["default"] = mod;
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.issue = exports.issueCommand = void 0;
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const utils_1 = __webpack_require__(278);
|
const utils_1 = __webpack_require__(278);
|
||||||
/**
|
/**
|
||||||
@@ -484,6 +527,25 @@ function escapeProperty(s) {
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -493,14 +555,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
||||||
const command_1 = __webpack_require__(241);
|
const command_1 = __webpack_require__(241);
|
||||||
const file_command_1 = __webpack_require__(717);
|
const file_command_1 = __webpack_require__(717);
|
||||||
const utils_1 = __webpack_require__(278);
|
const utils_1 = __webpack_require__(278);
|
||||||
@@ -567,7 +623,9 @@ function addPath(inputPath) {
|
|||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
/**
|
/**
|
||||||
* Gets the value of an input. The value is also trimmed.
|
* Gets the value of an input.
|
||||||
|
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
||||||
|
* Returns an empty string if the value is not defined.
|
||||||
*
|
*
|
||||||
* @param name name of the input to get
|
* @param name name of the input to get
|
||||||
* @param options optional. See InputOptions.
|
* @param options optional. See InputOptions.
|
||||||
@@ -578,9 +636,34 @@ function getInput(name, options) {
|
|||||||
if (options && options.required && !val) {
|
if (options && options.required && !val) {
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
}
|
}
|
||||||
|
if (options && options.trimWhitespace === false) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
return val.trim();
|
return val.trim();
|
||||||
}
|
}
|
||||||
exports.getInput = getInput;
|
exports.getInput = getInput;
|
||||||
|
/**
|
||||||
|
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||||
|
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
||||||
|
* The return value is also in boolean type.
|
||||||
|
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
||||||
|
*
|
||||||
|
* @param name name of the input to get
|
||||||
|
* @param options optional. See InputOptions.
|
||||||
|
* @returns boolean
|
||||||
|
*/
|
||||||
|
function getBooleanInput(name, options) {
|
||||||
|
const trueValue = ['true', 'True', 'TRUE'];
|
||||||
|
const falseValue = ['false', 'False', 'FALSE'];
|
||||||
|
const val = getInput(name, options);
|
||||||
|
if (trueValue.includes(val))
|
||||||
|
return true;
|
||||||
|
if (falseValue.includes(val))
|
||||||
|
return false;
|
||||||
|
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
||||||
|
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||||
|
}
|
||||||
|
exports.getBooleanInput = getBooleanInput;
|
||||||
/**
|
/**
|
||||||
* Sets the value of an output.
|
* Sets the value of an output.
|
||||||
*
|
*
|
||||||
@@ -589,6 +672,7 @@ exports.getInput = getInput;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function setOutput(name, value) {
|
function setOutput(name, value) {
|
||||||
|
process.stdout.write(os.EOL);
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
}
|
}
|
||||||
exports.setOutput = setOutput;
|
exports.setOutput = setOutput;
|
||||||
@@ -730,14 +814,27 @@ exports.getState = getState;
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// For internal use, subject to change.
|
// For internal use, subject to change.
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
result["default"] = mod;
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.issueCommand = void 0;
|
||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
@@ -768,6 +865,7 @@ exports.issueCommand = issueCommand;
|
|||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.toCommandValue = void 0;
|
||||||
/**
|
/**
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
* @param input input to sanitize into a string
|
* @param input input to sanitize into a string
|
||||||
@@ -2558,6 +2656,25 @@ function copyFile(srcFile, destFile, force) {
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -2567,14 +2684,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0;
|
||||||
const semver = __importStar(__webpack_require__(562));
|
const semver = __importStar(__webpack_require__(562));
|
||||||
const core_1 = __webpack_require__(186);
|
const core_1 = __webpack_require__(186);
|
||||||
// needs to be require for core node modules to be mocked
|
// needs to be require for core node modules to be mocked
|
||||||
@@ -2671,6 +2782,25 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -2680,14 +2810,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.RetryHelper = void 0;
|
||||||
const core = __importStar(__webpack_require__(186));
|
const core = __importStar(__webpack_require__(186));
|
||||||
/**
|
/**
|
||||||
* Internal class for retries
|
* Internal class for retries
|
||||||
@@ -2748,6 +2872,25 @@ exports.RetryHelper = RetryHelper;
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -2757,17 +2900,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0;
|
||||||
const core = __importStar(__webpack_require__(186));
|
const core = __importStar(__webpack_require__(186));
|
||||||
const io = __importStar(__webpack_require__(351));
|
const io = __importStar(__webpack_require__(351));
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
@@ -2799,9 +2936,10 @@ const userAgent = 'actions/tool-cache';
|
|||||||
* @param url url of tool to download
|
* @param url url of tool to download
|
||||||
* @param dest path to download tool
|
* @param dest path to download tool
|
||||||
* @param auth authorization header
|
* @param auth authorization header
|
||||||
|
* @param headers other headers
|
||||||
* @returns path to downloaded tool
|
* @returns path to downloaded tool
|
||||||
*/
|
*/
|
||||||
function downloadTool(url, dest, auth) {
|
function downloadTool(url, dest, auth, headers) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
dest = dest || path.join(_getTempDirectory(), v4_1.default());
|
dest = dest || path.join(_getTempDirectory(), v4_1.default());
|
||||||
yield io.mkdirP(path.dirname(dest));
|
yield io.mkdirP(path.dirname(dest));
|
||||||
@@ -2812,7 +2950,7 @@ function downloadTool(url, dest, auth) {
|
|||||||
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
|
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
|
||||||
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
|
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
|
||||||
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
return yield downloadToolAttempt(url, dest || '', auth);
|
return yield downloadToolAttempt(url, dest || '', auth, headers);
|
||||||
}), (err) => {
|
}), (err) => {
|
||||||
if (err instanceof HTTPError && err.httpStatusCode) {
|
if (err instanceof HTTPError && err.httpStatusCode) {
|
||||||
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
|
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
|
||||||
@@ -2828,7 +2966,7 @@ function downloadTool(url, dest, auth) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.downloadTool = downloadTool;
|
exports.downloadTool = downloadTool;
|
||||||
function downloadToolAttempt(url, dest, auth) {
|
function downloadToolAttempt(url, dest, auth, headers) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (fs.existsSync(dest)) {
|
if (fs.existsSync(dest)) {
|
||||||
throw new Error(`Destination file path ${dest} already exists`);
|
throw new Error(`Destination file path ${dest} already exists`);
|
||||||
@@ -2837,12 +2975,12 @@ function downloadToolAttempt(url, dest, auth) {
|
|||||||
const http = new httpm.HttpClient(userAgent, [], {
|
const http = new httpm.HttpClient(userAgent, [], {
|
||||||
allowRetries: false
|
allowRetries: false
|
||||||
});
|
});
|
||||||
let headers;
|
|
||||||
if (auth) {
|
if (auth) {
|
||||||
core.debug('set auth');
|
core.debug('set auth');
|
||||||
headers = {
|
if (headers === undefined) {
|
||||||
authorization: auth
|
headers = {};
|
||||||
};
|
}
|
||||||
|
headers.authorization = auth;
|
||||||
}
|
}
|
||||||
const response = yield http.get(url, headers);
|
const response = yield http.get(url, headers);
|
||||||
if (response.message.statusCode !== 200) {
|
if (response.message.statusCode !== 200) {
|
||||||
@@ -3000,6 +3138,7 @@ function extractTar(file, dest, flags = 'xz') {
|
|||||||
if (isGnuTar) {
|
if (isGnuTar) {
|
||||||
// Suppress warnings when using GNU tar to extract archives created by BSD tar
|
// Suppress warnings when using GNU tar to extract archives created by BSD tar
|
||||||
args.push('--warning=no-unknown-keyword');
|
args.push('--warning=no-unknown-keyword');
|
||||||
|
args.push('--overwrite');
|
||||||
}
|
}
|
||||||
args.push('-C', destArg, '-f', fileArg);
|
args.push('-C', destArg, '-f', fileArg);
|
||||||
yield exec_1.exec(`tar`, args);
|
yield exec_1.exec(`tar`, args);
|
||||||
@@ -3065,20 +3204,50 @@ function extractZipWin(file, dest) {
|
|||||||
// build the powershell command
|
// build the powershell command
|
||||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
const pwshPath = yield io.which('pwsh', false);
|
||||||
// run powershell
|
//To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
|
||||||
const powershellPath = yield io.which('powershell', true);
|
//and the -Force flag for Expand-Archive as a fallback
|
||||||
const args = [
|
if (pwshPath) {
|
||||||
'-NoLogo',
|
//attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
|
||||||
'-Sta',
|
const pwshCommand = [
|
||||||
'-NoProfile',
|
`$ErrorActionPreference = 'Stop' ;`,
|
||||||
'-NonInteractive',
|
`try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
|
||||||
'-ExecutionPolicy',
|
`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
|
||||||
'Unrestricted',
|
`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;`
|
||||||
'-Command',
|
].join(' ');
|
||||||
command
|
const args = [
|
||||||
];
|
'-NoLogo',
|
||||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
'-NoProfile',
|
||||||
|
'-NonInteractive',
|
||||||
|
'-ExecutionPolicy',
|
||||||
|
'Unrestricted',
|
||||||
|
'-Command',
|
||||||
|
pwshCommand
|
||||||
|
];
|
||||||
|
core.debug(`Using pwsh at path: ${pwshPath}`);
|
||||||
|
yield exec_1.exec(`"${pwshPath}"`, args);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const powershellCommand = [
|
||||||
|
`$ErrorActionPreference = 'Stop' ;`,
|
||||||
|
`try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
|
||||||
|
`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
|
||||||
|
`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
|
||||||
|
].join(' ');
|
||||||
|
const args = [
|
||||||
|
'-NoLogo',
|
||||||
|
'-Sta',
|
||||||
|
'-NoProfile',
|
||||||
|
'-NonInteractive',
|
||||||
|
'-ExecutionPolicy',
|
||||||
|
'Unrestricted',
|
||||||
|
'-Command',
|
||||||
|
powershellCommand
|
||||||
|
];
|
||||||
|
const powershellPath = yield io.which('powershell', true);
|
||||||
|
core.debug(`Using powershell at path: ${powershellPath}`);
|
||||||
|
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function extractZipNix(file, dest) {
|
function extractZipNix(file, dest) {
|
||||||
@@ -3088,6 +3257,7 @@ function extractZipNix(file, dest) {
|
|||||||
if (!core.isDebug()) {
|
if (!core.isDebug()) {
|
||||||
args.unshift('-q');
|
args.unshift('-q');
|
||||||
}
|
}
|
||||||
|
args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
|
||||||
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
|
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -3170,9 +3340,9 @@ function find(toolName, versionSpec, arch) {
|
|||||||
}
|
}
|
||||||
arch = arch || os.arch();
|
arch = arch || os.arch();
|
||||||
// attempt to resolve an explicit version
|
// attempt to resolve an explicit version
|
||||||
if (!_isExplicitVersion(versionSpec)) {
|
if (!isExplicitVersion(versionSpec)) {
|
||||||
const localVersions = findAllVersions(toolName, arch);
|
const localVersions = findAllVersions(toolName, arch);
|
||||||
const match = _evaluateVersions(localVersions, versionSpec);
|
const match = evaluateVersions(localVersions, versionSpec);
|
||||||
versionSpec = match;
|
versionSpec = match;
|
||||||
}
|
}
|
||||||
// check for the explicit version in the cache
|
// check for the explicit version in the cache
|
||||||
@@ -3205,7 +3375,7 @@ function findAllVersions(toolName, arch) {
|
|||||||
if (fs.existsSync(toolPath)) {
|
if (fs.existsSync(toolPath)) {
|
||||||
const children = fs.readdirSync(toolPath);
|
const children = fs.readdirSync(toolPath);
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
if (_isExplicitVersion(child)) {
|
if (isExplicitVersion(child)) {
|
||||||
const fullPath = path.join(toolPath, child, arch || '');
|
const fullPath = path.join(toolPath, child, arch || '');
|
||||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||||
versions.push(child);
|
versions.push(child);
|
||||||
@@ -3288,14 +3458,26 @@ function _completeToolPath(tool, version, arch) {
|
|||||||
fs.writeFileSync(markerPath, '');
|
fs.writeFileSync(markerPath, '');
|
||||||
core.debug('finished caching tool');
|
core.debug('finished caching tool');
|
||||||
}
|
}
|
||||||
function _isExplicitVersion(versionSpec) {
|
/**
|
||||||
|
* Check if version string is explicit
|
||||||
|
*
|
||||||
|
* @param versionSpec version string to check
|
||||||
|
*/
|
||||||
|
function isExplicitVersion(versionSpec) {
|
||||||
const c = semver.clean(versionSpec) || '';
|
const c = semver.clean(versionSpec) || '';
|
||||||
core.debug(`isExplicit: ${c}`);
|
core.debug(`isExplicit: ${c}`);
|
||||||
const valid = semver.valid(c) != null;
|
const valid = semver.valid(c) != null;
|
||||||
core.debug(`explicit? ${valid}`);
|
core.debug(`explicit? ${valid}`);
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
function _evaluateVersions(versions, versionSpec) {
|
exports.isExplicitVersion = isExplicitVersion;
|
||||||
|
/**
|
||||||
|
* Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
|
||||||
|
*
|
||||||
|
* @param versions array of versions to evaluate
|
||||||
|
* @param versionSpec semantic version spec to satisfy
|
||||||
|
*/
|
||||||
|
function evaluateVersions(versions, versionSpec) {
|
||||||
let version = '';
|
let version = '';
|
||||||
core.debug(`evaluating ${versions.length} versions`);
|
core.debug(`evaluating ${versions.length} versions`);
|
||||||
versions = versions.sort((a, b) => {
|
versions = versions.sort((a, b) => {
|
||||||
@@ -3320,6 +3502,7 @@ function _evaluateVersions(versions, versionSpec) {
|
|||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
exports.evaluateVersions = evaluateVersions;
|
||||||
/**
|
/**
|
||||||
* Gets RUNNER_TOOL_CACHE
|
* Gets RUNNER_TOOL_CACHE
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-2
@@ -21,10 +21,10 @@
|
|||||||
"author": "CrazyMax",
|
"author": "CrazyMax",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.3.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^1.0.11",
|
||||||
"@actions/tool-cache": "^1.6.1"
|
"@actions/tool-cache": "^1.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.14",
|
"@types/jest": "^26.0.14",
|
||||||
|
|||||||
+20
-8
@@ -1,36 +1,44 @@
|
|||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
import * as pro from './pro';
|
||||||
|
|
||||||
export interface GitHubRelease {
|
export interface GitHubRelease {
|
||||||
id: number;
|
id: number;
|
||||||
tag_name: string;
|
tag_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getRelease = async (version: string): Promise<GitHubRelease | null> => {
|
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease | null> => {
|
||||||
const resolvedVersion: string = (await resolveVersion(version)) || version;
|
const resolvedVersion: string = (await resolveVersion(distribution, version)) || version;
|
||||||
const url: string = `https://github.com/goreleaser/goreleaser/releases/${resolvedVersion}`;
|
const url: string = `https://github.com/goreleaser/${distribution}/releases/${resolvedVersion}`;
|
||||||
const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action');
|
const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action');
|
||||||
return (await http.getJson<GitHubRelease>(url)).result;
|
return (await http.getJson<GitHubRelease>(url)).result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveVersion = async (version: string): Promise<string | null> => {
|
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
||||||
const allTags: Array<string> | null = await getAllTags();
|
const allTags: Array<string> | null = await getAllTags(distribution);
|
||||||
if (!allTags) {
|
if (!allTags) {
|
||||||
throw new Error(`Cannot find GoReleaser tags`);
|
throw new Error(`Cannot find GoReleaser tags`);
|
||||||
}
|
}
|
||||||
core.debug(`Found ${allTags.length} tags in total`);
|
core.debug(`Found ${allTags.length} tags in total`);
|
||||||
|
|
||||||
return semver.maxSatisfying(allTags, version);
|
if (version === 'latest' || !pro.isPro(distribution)) {
|
||||||
|
return semver.maxSatisfying(allTags, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
const cleanTags: Array<string> = allTags.map(tag => cleanTag(tag));
|
||||||
|
const cleanVersion: string = cleanTag(version);
|
||||||
|
return semver.maxSatisfying(cleanTags, cleanVersion) + pro.suffix(distribution);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface GitHubTag {
|
interface GitHubTag {
|
||||||
tag_name: string;
|
tag_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAllTags = async (): Promise<Array<string>> => {
|
const getAllTags = async (distribution: string): Promise<Array<string>> => {
|
||||||
const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action');
|
const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action');
|
||||||
const url: string = `https://goreleaser.com/static/releases.json`;
|
const suffix: string = pro.suffix(distribution);
|
||||||
|
const url: string = `https://goreleaser.com/static/releases${suffix}.json`;
|
||||||
const getTags = http.getJson<Array<GitHubTag>>(url);
|
const getTags = http.getJson<Array<GitHubTag>>(url);
|
||||||
|
|
||||||
return getTags.then(response => {
|
return getTags.then(response => {
|
||||||
@@ -41,3 +49,7 @@ const getAllTags = async (): Promise<Array<string>> => {
|
|||||||
return response.result.map(obj => obj.tag_name);
|
return response.result.map(obj => obj.tag_name);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cleanTag = (tag: string): string => {
|
||||||
|
return tag.replace(/-pro$/, '');
|
||||||
|
};
|
||||||
|
|||||||
+9
-6
@@ -2,22 +2,24 @@ import * as os from 'os';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
import * as github from './github';
|
import * as github from './github';
|
||||||
|
import * as pro from './pro';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
|
|
||||||
const osPlat: string = os.platform();
|
const osPlat: string = os.platform();
|
||||||
const osArch: string = os.arch();
|
const osArch: string = os.arch();
|
||||||
|
|
||||||
export async function getGoReleaser(version: string): Promise<string> {
|
export async function getGoReleaser(distribution: string, version: string): Promise<string> {
|
||||||
const release: github.GitHubRelease | null = await github.getRelease(version);
|
const release: github.GitHubRelease | null = await github.getRelease(distribution, version);
|
||||||
if (!release) {
|
if (!release) {
|
||||||
throw new Error(`Cannot find GoReleaser ${version} release`);
|
throw new Error(`Cannot find GoReleaser ${version} release`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`✅ GoReleaser version found: ${release.tag_name}`);
|
core.info(`✅ GoReleaser version found: ${release.tag_name}`);
|
||||||
const filename = getFilename();
|
const filename = getFilename(distribution);
|
||||||
const downloadUrl = util.format(
|
const downloadUrl = util.format(
|
||||||
'https://github.com/goreleaser/goreleaser/releases/download/%s/%s',
|
'https://github.com/goreleaser/%s/releases/download/%s/%s',
|
||||||
|
distribution,
|
||||||
release.tag_name,
|
release.tag_name,
|
||||||
filename
|
filename
|
||||||
);
|
);
|
||||||
@@ -44,9 +46,10 @@ export async function getGoReleaser(version: string): Promise<string> {
|
|||||||
return exePath;
|
return exePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFilename = (): string => {
|
const getFilename = (distribution: string): string => {
|
||||||
const platform: string = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
|
const platform: string = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
|
||||||
const arch: string = osArch == 'x64' ? 'x86_64' : 'i386';
|
const arch: string = osArch == 'x64' ? 'x86_64' : 'i386';
|
||||||
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
|
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
|
||||||
return util.format('goreleaser_%s_%s.%s', platform, arch, ext);
|
const suffix: string = pro.suffix(distribution);
|
||||||
|
return util.format('goreleaser%s_%s_%s.%s', suffix, platform, arch, ext);
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-1
@@ -6,11 +6,12 @@ import {dirname} from 'path';
|
|||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
const distribution = core.getInput('distribution') || 'goreleaser';
|
||||||
const version = core.getInput('version') || 'latest';
|
const version = core.getInput('version') || 'latest';
|
||||||
const args = core.getInput('args');
|
const args = core.getInput('args');
|
||||||
const workdir = core.getInput('workdir') || '.';
|
const workdir = core.getInput('workdir') || '.';
|
||||||
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
|
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
|
||||||
const goreleaser = await installer.getGoReleaser(version);
|
const goreleaser = await installer.getGoReleaser(distribution, version);
|
||||||
core.info(`✅ GoReleaser installed successfully`);
|
core.info(`✅ GoReleaser installed successfully`);
|
||||||
|
|
||||||
if (isInstallOnly) {
|
if (isInstallOnly) {
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export const suffix = (distribution: string): string => {
|
||||||
|
return isPro(distribution) ? '-pro' : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isPro = (distribution: string): boolean => {
|
||||||
|
return distribution === 'goreleaser-pro';
|
||||||
|
};
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@actions/core@^1.2.6":
|
"@actions/core@^1.2.6", "@actions/core@^1.3.0":
|
||||||
version "1.2.6"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
|
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.3.0.tgz#f5e4b24c889e7f2e58b466cc8c7481292284eba0"
|
||||||
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
|
integrity sha512-xxtX0Cwdhb8LcgatfJkokqT8KzPvcIbwL9xpLU09nOwBzaStbfm0dNncsP0M4us+EpoPdWy7vbzU5vSOH7K6pg==
|
||||||
|
|
||||||
"@actions/exec@^1.0.0", "@actions/exec@^1.0.4":
|
"@actions/exec@^1.0.0", "@actions/exec@^1.0.4":
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
@@ -26,10 +26,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.0.2.tgz#2f614b6e69ce14d191180451eb38e6576a6e6b27"
|
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.0.2.tgz#2f614b6e69ce14d191180451eb38e6576a6e6b27"
|
||||||
integrity sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==
|
integrity sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==
|
||||||
|
|
||||||
"@actions/tool-cache@^1.6.1":
|
"@actions/tool-cache@^1.7.0":
|
||||||
version "1.6.1"
|
version "1.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/@actions/tool-cache/-/tool-cache-1.6.1.tgz#5e199f7bfd9863eb2b0d467cd70751ef8042ec40"
|
resolved "https://registry.yarnpkg.com/@actions/tool-cache/-/tool-cache-1.7.0.tgz#bd9d5996d8cd3c50b61b8d6d1c3fb134e962cc21"
|
||||||
integrity sha512-F+vwEDwfqcHMKuSkj79pihOnsAMv23EkG76nMpc82UsnXwyQdyEsktGxrB0SNtm7pRqTXEIOoAPTgrSQclXYTg==
|
integrity sha512-ybO7s67MueJVwWGP4kLynzjW/4Rsiy5/RD9+XJsi/8JHbmYjXdBiluuJdwanQOsmQvZJRe8OkNzaLEnLuMu+qA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/core" "^1.2.6"
|
"@actions/core" "^1.2.6"
|
||||||
"@actions/exec" "^1.0.0"
|
"@actions/exec" "^1.0.0"
|
||||||
@@ -1656,9 +1656,9 @@ has-values@^1.0.0:
|
|||||||
kind-of "^4.0.0"
|
kind-of "^4.0.0"
|
||||||
|
|
||||||
hosted-git-info@^2.1.4:
|
hosted-git-info@^2.1.4:
|
||||||
version "2.8.8"
|
version "2.8.9"
|
||||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488"
|
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
|
||||||
integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==
|
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
|
||||||
|
|
||||||
html-encoding-sniffer@^2.0.1:
|
html-encoding-sniffer@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
@@ -2512,9 +2512,9 @@ lodash.sortby@^4.7.0:
|
|||||||
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
||||||
|
|
||||||
lodash@^4.17.13, lodash@^4.17.15:
|
lodash@^4.17.13, lodash@^4.17.15:
|
||||||
version "4.17.19"
|
version "4.17.21"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||||
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
|
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||||
|
|
||||||
lru-cache@^4.1.5:
|
lru-cache@^4.1.5:
|
||||||
version "4.1.5"
|
version "4.1.5"
|
||||||
@@ -3780,9 +3780,9 @@ write-file-atomic@^3.0.0:
|
|||||||
typedarray-to-buffer "^3.1.5"
|
typedarray-to-buffer "^3.1.5"
|
||||||
|
|
||||||
ws@^7.2.3:
|
ws@^7.2.3:
|
||||||
version "7.3.0"
|
version "7.4.6"
|
||||||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.0.tgz#4b2f7f219b3d3737bc1a2fbf145d825b94d38ffd"
|
resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c"
|
||||||
integrity sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==
|
integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==
|
||||||
|
|
||||||
xml-name-validator@^3.0.0:
|
xml-name-validator@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user