mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-30 00:08:28 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44b6852272 | ||
|
|
aff4fc5a2c | ||
|
|
c30b077d74 | ||
|
|
3b7a8e97ab | ||
|
|
10511362f8 | ||
|
|
62b67a060c | ||
|
|
de0cc32957 | ||
|
|
07505093f2 | ||
|
|
de0090dcf9 | ||
|
|
56a17acc58 | ||
|
|
e9d8a486b9 | ||
|
|
1de7ab1241 | ||
|
|
da499dc8c4 | ||
|
|
bf5c0312ba | ||
|
|
30f55a5465 | ||
|
|
46fecbc374 | ||
|
|
e2e0026788 | ||
|
|
c782db219c | ||
|
|
e4f3e46c3a | ||
|
|
354ab336f2 | ||
|
|
aa45e0b3de | ||
|
|
3fc0ad887b | ||
|
|
5ea6f8cff6 | ||
|
|
408809cf2e | ||
|
|
5df9eaf51a | ||
|
|
2f7115b6eb | ||
|
|
6e289c036a | ||
|
|
8d2d6e23ba | ||
|
|
e3e8938134 | ||
|
|
aa1fbb5b7f | ||
|
|
0122c3b611 | ||
|
|
32c621e48f | ||
|
|
d922612e4f | ||
|
|
4f52b7bd4b | ||
|
|
5067175657 | ||
|
|
1723202839 | ||
|
|
277675f877 | ||
|
|
a9021ad9f8 | ||
|
|
551f7d8a6c | ||
|
|
849d1c01b1 | ||
|
|
ac187d128a | ||
|
|
108bc4da5a | ||
|
|
92b29cc8ff | ||
|
|
87487e9bbd | ||
|
|
99636ee53c | ||
|
|
3140f0a474 |
@@ -0,0 +1,20 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
time: "06:00"
|
||||||
|
timezone: "Europe/Paris"
|
||||||
|
labels:
|
||||||
|
- "dependencies"
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
time: "06:00"
|
||||||
|
timezone: "Europe/Paris"
|
||||||
|
allow:
|
||||||
|
- dependency-type: "production"
|
||||||
|
labels:
|
||||||
|
- "dependencies"
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 10 * * *' # everyday at 10am
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- releases/v*
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- master
|
||||||
- 'releases/'
|
- releases/v*
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@@ -28,9 +29,8 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
with:
|
||||||
name: Unshallow
|
fetch-depth: 0
|
||||||
run: git fetch --prune --unshallow
|
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
@@ -62,9 +62,8 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
with:
|
||||||
name: Unshallow
|
fetch-depth: 0
|
||||||
run: git fetch --prune --unshallow
|
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
@@ -72,7 +71,8 @@ jobs:
|
|||||||
go-version: 1.14
|
go-version: 1.14
|
||||||
-
|
-
|
||||||
name: Import GPG key
|
name: Import GPG key
|
||||||
uses: crazy-max/ghaction-import-gpg@v1
|
id: import_gpg
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v2
|
||||||
env:
|
env:
|
||||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY_TEST }}
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY_TEST }}
|
||||||
PASSPHRASE: ${{ secrets.PASSPHRASE_TEST }}
|
PASSPHRASE: ${{ secrets.PASSPHRASE_TEST }}
|
||||||
@@ -82,9 +82,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: -f .goreleaser-signing.yml check --debug
|
args: -f .goreleaser-signing.yml check --debug
|
||||||
|
env:
|
||||||
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
-
|
-
|
||||||
name: GoReleaser
|
name: GoReleaser
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: -f .goreleaser-signing.yml release --skip-publish --rm-dist
|
args: -f .goreleaser-signing.yml release --skip-publish --rm-dist
|
||||||
|
env:
|
||||||
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
name: lint
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- '.github/workflows/lint.yml'
|
|
||||||
- 'src/*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
# https://github.com/actions/checkout
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
-
|
|
||||||
# https://github.com/actions/setup-node
|
|
||||||
name: Set up Node
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
-
|
|
||||||
name: Setup TS
|
|
||||||
run: npm install tslint typescript -g
|
|
||||||
-
|
|
||||||
name: Lint check
|
|
||||||
run: tslint './src/*.ts'
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
name: pre-checkin
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre-checkin:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Install
|
||||||
|
run: yarn install
|
||||||
|
-
|
||||||
|
name: Pre-checkin
|
||||||
|
run: yarn run pre-checkin
|
||||||
|
-
|
||||||
|
name: Check for uncommitted changes
|
||||||
|
run: |
|
||||||
|
if [[ `git status --porcelain` ]]; then
|
||||||
|
git status --porcelain
|
||||||
|
echo "::warning::Found changes. Please run 'yarn run pre-checkin' and push"
|
||||||
|
fi
|
||||||
@@ -3,8 +3,8 @@ name: test
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- master
|
||||||
- 'releases/*'
|
- releases/v*
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -23,22 +23,19 @@ jobs:
|
|||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
# https://github.com/actions/checkout
|
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
with:
|
||||||
name: Unshallow
|
fetch-depth: 0
|
||||||
run: git fetch --prune --unshallow
|
|
||||||
-
|
-
|
||||||
name: Install
|
name: Install
|
||||||
run: npm install
|
run: yarn install
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
run: npm run test
|
run: yarn run test
|
||||||
-
|
-
|
||||||
# https://github.com/codecov/codecov-action
|
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1.0.7
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
@@ -37,4 +37,4 @@ checksum:
|
|||||||
signs:
|
signs:
|
||||||
-
|
-
|
||||||
artifacts: checksum
|
artifacts: checksum
|
||||||
args: ["--batch", "-u", "27571A53B86AF0C799B38BA77D851EB72D73BDA0", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
version = 1
|
||||||
|
|
||||||
|
[merge]
|
||||||
|
automerge_label = "automerge"
|
||||||
|
blacklist_title_regex = "^WIP.*"
|
||||||
|
method = "squash"
|
||||||
|
delete_branch_on_merge = true
|
||||||
|
block_on_reviews_requested = false
|
||||||
|
notify_on_conflict = true
|
||||||
|
optimistic_updates = true
|
||||||
|
|
||||||
|
[merge.message]
|
||||||
|
title = "pull_request_title"
|
||||||
|
include_pr_number = true
|
||||||
|
body_type = "markdown"
|
||||||
@@ -1,5 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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)
|
## 2.0.0 (2020/05/10)
|
||||||
|
|
||||||
* Remove `key` input and use [Import GPG](https://github.com/crazy-max/ghaction-import-gpg) GitHub Action instead.
|
* Remove `key` input and use [Import GPG](https://github.com/crazy-max/ghaction-import-gpg) GitHub Action instead.
|
||||||
@@ -7,6 +20,10 @@
|
|||||||
* Go 1.14
|
* Go 1.14
|
||||||
* Update deps
|
* Update deps
|
||||||
|
|
||||||
|
## 1.5.1 (2020/05/10)
|
||||||
|
|
||||||
|
* Mark `key` input as deprecated
|
||||||
|
|
||||||
## 1.5.0 (2020/05/07)
|
## 1.5.0 (2020/05/07)
|
||||||
|
|
||||||
* Use native GitHub Action tools to download assets and use GitHub API
|
* Use native GitHub Action tools to download assets and use GitHub API
|
||||||
|
|||||||
@@ -43,9 +43,8 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
with:
|
||||||
name: Unshallow
|
fetch-depth: 0
|
||||||
run: git fetch --prune --unshallow
|
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
@@ -61,7 +60,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
> **IMPORTANT**: note the `Unshallow` 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.
|
||||||
|
|
||||||
### Run on new tag
|
### Run on new tag
|
||||||
|
|
||||||
@@ -97,7 +96,8 @@ If [signing is enabled](https://goreleaser.com/customization/#Signing) in your G
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Import GPG key
|
name: Import GPG key
|
||||||
uses: crazy-max/ghaction-import-gpg@v1
|
id: import_gpg
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v2
|
||||||
env:
|
env:
|
||||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
PASSPHRASE: ${{ secrets.PASSPHRASE }}
|
PASSPHRASE: ${{ secrets.PASSPHRASE }}
|
||||||
@@ -109,14 +109,15 @@ If [signing is enabled](https://goreleaser.com/customization/#Signing) in your G
|
|||||||
args: release --rm-dist
|
args: release --rm-dist
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
```
|
```
|
||||||
|
|
||||||
And reference the userID in your signing configuration:
|
And reference the fingerprint in your signing configuration using the `GPG_FINGERPRINT` environment variable:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
signs:
|
signs:
|
||||||
- artifacts: checksum
|
- artifacts: checksum
|
||||||
args: ["--batch", "-u", "<key id, fingerprint, email, ...>", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
@@ -125,11 +126,13 @@ signs:
|
|||||||
|
|
||||||
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. Example: `v0.117.0` |
|
| `version`**¹** | String | `latest` | GoReleaser version |
|
||||||
| `args` | String | | Arguments to pass to GoReleaser |
|
| `args` | String | | Arguments to pass to GoReleaser |
|
||||||
| `workdir` | String | `.` | Working directory (below repository root) |
|
| `workdir` | String | `.` | Working directory (below repository root) |
|
||||||
|
|
||||||
|
> **¹** 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`.
|
||||||
|
|
||||||
### environment variables
|
### environment variables
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import * as git from '../src/git';
|
|||||||
describe('git', () => {
|
describe('git', () => {
|
||||||
it('returns git tag', async () => {
|
it('returns git tag', async () => {
|
||||||
const tag: string = await git.getTag();
|
const tag: string = await git.getTag();
|
||||||
console.log(tag);
|
|
||||||
expect(tag).not.toEqual('');
|
expect(tag).not.toEqual('');
|
||||||
});
|
});
|
||||||
it('checks if tag is dirty', async () => {
|
it('checks if tag is dirty', async () => {
|
||||||
@@ -11,7 +10,6 @@ describe('git', () => {
|
|||||||
});
|
});
|
||||||
it('returns short commit', async () => {
|
it('returns short commit', async () => {
|
||||||
const commit: string = await git.getShortCommit();
|
const commit: string = await git.getShortCommit();
|
||||||
console.log(commit);
|
|
||||||
expect(commit).not.toEqual('');
|
expect(commit).not.toEqual('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,14 +3,17 @@ 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('latest');
|
||||||
console.log(release);
|
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).not.toEqual('');
|
expect(release?.tag_name).not.toEqual('');
|
||||||
});
|
});
|
||||||
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('v0.117.0');
|
||||||
console.log(release);
|
|
||||||
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 () => {
|
||||||
|
const release = await github.getRelease('~> 0.132');
|
||||||
|
expect(release).not.toBeNull();
|
||||||
|
expect(release?.tag_name).toEqual('v0.132.1');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ 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('v0.117.0');
|
||||||
console.log(goreleaser);
|
|
||||||
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('latest');
|
||||||
console.log(goreleaser);
|
|
||||||
expect(fs.existsSync(goreleaser)).toBe(true);
|
expect(fs.existsSync(goreleaser)).toBe(true);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ branding:
|
|||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'GoReleaser version. Example: v0.118.0'
|
description: 'GoReleaser version'
|
||||||
default: 'latest'
|
default: 'latest'
|
||||||
required: false
|
required: false
|
||||||
args:
|
args:
|
||||||
|
|||||||
+3263
-1498
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -1,10 +1,14 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
setupFiles: ["dotenv/config"],
|
setupFiles: [
|
||||||
|
"dotenv/config",
|
||||||
|
"<rootDir>/src/test_setup.ts"
|
||||||
|
],
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
testRunner: 'jest-circus/runner',
|
testRunner: 'jest-circus/runner',
|
||||||
|
testTimeout: 10000,
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest'
|
||||||
},
|
},
|
||||||
|
|||||||
Generated
-7490
File diff suppressed because it is too large
Load Diff
+10
-11
@@ -7,8 +7,7 @@
|
|||||||
"test": "jest --coverage",
|
"test": "jest --coverage",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"cleanup-paths": "removeNPMAbsolutePaths ./ --force --fields _where _args",
|
"pre-checkin": "yarn run format && yarn run build"
|
||||||
"pre-checkin": "npm run format && npm run cleanup-paths && npm run build"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -25,20 +24,20 @@
|
|||||||
"@actions/core": "^1.2.4",
|
"@actions/core": "^1.2.4",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/http-client": "^1.0.8",
|
"@actions/http-client": "^1.0.8",
|
||||||
"@actions/tool-cache": "^1.3.4"
|
"@actions/tool-cache": "^1.5.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^25.2.1",
|
"@types/jest": "^26.0.0",
|
||||||
"@types/node": "^13.13.5",
|
"@types/node": "^14.0.13",
|
||||||
"@zeit/ncc": "^0.22.1",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"jest": "^25.5.4",
|
"jest": "^26.0.1",
|
||||||
"jest-circus": "^26.0.1",
|
"jest-circus": "^26.0.1",
|
||||||
"jest-runtime": "^26.0.1",
|
"jest-runtime": "^26.0.1",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"removeNPMAbsolutePaths": "^2.0.0",
|
"tmp": "^0.2.1",
|
||||||
"ts-jest": "^25.5.0",
|
"ts-jest": "^26.1.0",
|
||||||
"typescript": "^3.8.3",
|
"typescript": "^3.9.5",
|
||||||
"typescript-formatter": "^7.2.2"
|
"typescript-formatter": "^7.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-1
@@ -1,4 +1,6 @@
|
|||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as semver from 'semver';
|
||||||
|
|
||||||
export interface GitHubRelease {
|
export interface GitHubRelease {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -6,7 +8,36 @@ export interface GitHubRelease {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const getRelease = async (version: string): Promise<GitHubRelease | null> => {
|
export const getRelease = async (version: string): Promise<GitHubRelease | null> => {
|
||||||
const url: string = `https://github.com/goreleaser/goreleaser/releases/${version}`;
|
const resolvedVersion: string = (await resolveVersion(version)) || version;
|
||||||
|
const url: string = `https://github.com/goreleaser/goreleaser/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 allTags: Array<string> | null = await getAllTags();
|
||||||
|
if (!allTags) {
|
||||||
|
throw new Error(`Cannot find GoReleaser tags`);
|
||||||
|
}
|
||||||
|
core.debug(`Found ${allTags.length} tags in total`);
|
||||||
|
|
||||||
|
return semver.maxSatisfying(allTags, version);
|
||||||
|
};
|
||||||
|
|
||||||
|
interface GitHubTag {
|
||||||
|
tag_name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getAllTags = async (): Promise<Array<string>> => {
|
||||||
|
const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action');
|
||||||
|
const url: string = `https://goreleaser.com/static/releases.json`;
|
||||||
|
const getTags = http.getJson<Array<GitHubTag>>(url);
|
||||||
|
|
||||||
|
return getTags.then(response => {
|
||||||
|
if (response.result == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.result.map(obj => obj.tag_name);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import tmp = require('tmp');
|
||||||
|
|
||||||
|
tmp.setGracefulCleanup();
|
||||||
|
const tmpdir = tmp.dirSync({template: 'goreleaser-XXXXXX'});
|
||||||
|
process.env = Object.assign(process.env, {
|
||||||
|
RUNNER_TEMP: tmpdir.name,
|
||||||
|
RUNNER_TOOL_CACHE: tmpdir.name,
|
||||||
|
GITHUB_ACTION: '1'
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user