mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-29 21:18:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fdedb94ab | ||
|
|
81d9ad7185 | ||
|
|
a10d0e32dc | ||
|
|
3fa32b8bb5 | ||
|
|
c7c9447c79 | ||
|
|
920a7cbd0a | ||
|
|
336e29918d | ||
|
|
37247345b4 | ||
|
|
f424e9de13 | ||
|
|
7e0ddfe79f | ||
|
|
cffc4af7bf | ||
|
|
08e23ccf3b | ||
|
|
d756366df6 | ||
|
|
0c7e252c3a | ||
|
|
347176ca37 | ||
|
|
2fce7c4986 | ||
|
|
1d44853e58 | ||
|
|
45b37916b0 | ||
|
|
97503b1435 | ||
|
|
eeac89f426 | ||
|
|
8f389eacd3 | ||
|
|
f82d6c1c34 | ||
|
|
9754a253a8 | ||
|
|
b1a238106b | ||
|
|
b1ffc5d990 | ||
|
|
256e4b8b28 | ||
|
|
a7c543ca7a | ||
|
|
13f1e21a50 | ||
|
|
8f67e590f2 | ||
|
|
78df308971 | ||
|
|
66134d94a7 | ||
|
|
3c08cfd84b | ||
|
|
5dc579bb76 | ||
|
|
3b7d1ba946 | ||
|
|
23e0ed5919 | ||
|
|
1315dabfd1 | ||
|
|
b60ea886c6 | ||
|
|
4d25ab4fd4 |
+11
-1
@@ -1,2 +1,12 @@
|
|||||||
/coverage
|
/coverage
|
||||||
/node_modules
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
/.yarn/releases/** binary
|
||||||
|
/.yarn/plugins/** binary
|
||||||
/dist/** linguist-generated=true
|
/dist/** linguist-generated=true
|
||||||
/lib/** linguist-generated=true
|
/lib/** linguist-generated=true
|
||||||
|
|||||||
+59
-41
@@ -1,8 +1,13 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 10 * * *' # everyday at 10am
|
- cron: '0 10 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
@@ -10,9 +15,6 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
- 'releases/v*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@@ -26,19 +28,19 @@ jobs:
|
|||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
- latest
|
- latest
|
||||||
- '~> 0.182'
|
- '~> 1.15'
|
||||||
distribution:
|
distribution:
|
||||||
- goreleaser
|
- goreleaser
|
||||||
- goreleaser-pro
|
- goreleaser-pro
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
-
|
||||||
@@ -57,7 +59,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: ${{ matrix.distribution }}
|
distribution: ${{ matrix.distribution }}
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
args: release --skip-publish --rm-dist
|
args: release --skip-publish --clean --snapshot
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
|
|
||||||
install-only:
|
install-only:
|
||||||
@@ -74,12 +76,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
-
|
||||||
@@ -109,12 +111,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
-
|
||||||
@@ -138,7 +140,7 @@ jobs:
|
|||||||
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 --clean --snapshot
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
env:
|
env:
|
||||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
@@ -148,12 +150,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
-
|
||||||
@@ -166,7 +168,7 @@ jobs:
|
|||||||
name: GoReleaser
|
name: GoReleaser
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: release --skip-publish --rm-dist
|
args: release --skip-publish --clean --snapshot
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
-
|
-
|
||||||
name: Upload assets
|
name: Upload assets
|
||||||
@@ -175,48 +177,64 @@ jobs:
|
|||||||
name: myapp
|
name: myapp
|
||||||
path: ./test/dist/*
|
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:
|
dist:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
-
|
||||||
name: GoReleaser
|
name: GoReleaser
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: release --config .goreleaser-dist.yml --skip-publish --rm-dist
|
args: release --config .goreleaser-dist.yml --skip-publish --clean --snapshot
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
-
|
-
|
||||||
name: Check dist
|
name: Check dist
|
||||||
run: |
|
run: |
|
||||||
tree -nh ./test/_output
|
tree -nh ./test/_output
|
||||||
|
|
||||||
|
nightly:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macOS-latest
|
||||||
|
- windows-latest
|
||||||
|
distribution:
|
||||||
|
- goreleaser-pro
|
||||||
|
- goreleaser
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Set up Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: 1.18
|
||||||
|
-
|
||||||
|
name: GoReleaser
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
install-only: true
|
||||||
|
distribution: ${{ matrix.distribution }}
|
||||||
|
version: nightly
|
||||||
|
-
|
||||||
|
name: Check
|
||||||
|
run: |
|
||||||
|
goreleaser check -f ./test/.goreleaser.yml
|
||||||
|
goreleaser --version
|
||||||
|
goreleaser --version | grep nightly
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
name: test
|
name: test
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
- 'releases/v*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -16,17 +17,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
|
||||||
name: Validate
|
|
||||||
uses: docker/bake-action@v2
|
|
||||||
with:
|
|
||||||
targets: validate
|
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v3
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
name: validate
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
targets: ${{ steps.targets.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Targets matrix
|
||||||
|
id: targets
|
||||||
|
run: |
|
||||||
|
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Validate
|
||||||
|
uses: docker/bake-action@v3
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
+14
-57
@@ -1,12 +1,5 @@
|
|||||||
/.dev
|
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
||||||
node_modules/
|
|
||||||
lib
|
|
||||||
|
|
||||||
# Jetbrains
|
|
||||||
/.idea
|
|
||||||
/*.iml
|
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
@@ -14,6 +7,7 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
@@ -24,34 +18,14 @@ pids
|
|||||||
*.seed
|
*.seed
|
||||||
*.pid.lock
|
*.pid.lock
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
||||||
*.lcov
|
*.lcov
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# Bower dependency directory (https://bower.io/)
|
|
||||||
bower_components
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
jspm_packages/
|
jspm_packages/
|
||||||
|
|
||||||
# TypeScript v1 declaration files
|
|
||||||
typings/
|
|
||||||
|
|
||||||
# TypeScript cache
|
# TypeScript cache
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
@@ -61,36 +35,19 @@ typings/
|
|||||||
# Optional eslint cache
|
# Optional eslint cache
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
||||||
|
|
||||||
# Output of 'npm pack'
|
|
||||||
*.tgz
|
|
||||||
|
|
||||||
# Yarn Integrity file
|
# Yarn Integrity file
|
||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
# dotenv environment variables file
|
# dotenv environment variable files
|
||||||
.env
|
.env
|
||||||
.env.test
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
# yarn v2
|
||||||
.cache
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
# next.js build output
|
.yarn/build-state.yml
|
||||||
.next
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
# nuxt.js build output
|
|
||||||
.nuxt
|
|
||||||
|
|
||||||
# vuepress build output
|
|
||||||
.vuepress/dist
|
|
||||||
|
|
||||||
# Serverless directories
|
|
||||||
.serverless/
|
|
||||||
|
|
||||||
# FuseBox cache
|
|
||||||
.fusebox/
|
|
||||||
|
|
||||||
# DynamoDB Local files
|
|
||||||
.dynamodb/
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/
|
||||||
+541
File diff suppressed because one or more lines are too long
Vendored
+873
File diff suppressed because one or more lines are too long
+13
@@ -0,0 +1,13 @@
|
|||||||
|
logFilters:
|
||||||
|
- code: YN0013
|
||||||
|
level: discard
|
||||||
|
- code: YN0076
|
||||||
|
level: discard
|
||||||
|
|
||||||
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||||
|
spec: "@yarnpkg/plugin-interactive-tools"
|
||||||
|
|
||||||
|
yarnPath: .yarn/releases/yarn-3.5.1.cjs
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/goreleaser/goreleaser-action/releases/latest"><img alt="GitHub release" src="https://img.shields.io/github/release/goreleaser/goreleaser-action.svg?logo=github&style=flat-square"></a>
|
<a href="https://github.com/goreleaser/goreleaser-action/releases/latest"><img alt="GitHub release" src="https://img.shields.io/github/release/goreleaser/goreleaser-action.svg?logo=github&style=flat-square"></a>
|
||||||
<a href="https://github.com/marketplace/actions/goreleaser-action"><img alt="GitHub marketplace" src="https://img.shields.io/badge/marketplace-goreleaser--action-blue?logo=github&style=flat-square"></a>
|
<a href="https://github.com/marketplace/actions/goreleaser-action"><img alt="GitHub marketplace" src="https://img.shields.io/badge/marketplace-goreleaser--action-blue?logo=github&style=flat-square"></a>
|
||||||
<a href="https://github.com/goreleaser/goreleaser-action/actions?workflow=test"><img alt="Test workflow" src="https://img.shields.io/github/workflow/status/goreleaser/goreleaser-action/test?label=test&logo=github&style=flat-square"></a>
|
<a href="https://github.com/goreleaser/goreleaser-action/actions?workflow=test"><img alt="Test workflow" src="https://img.shields.io/github/actions/workflow/status/goreleaser/goreleaser-action/test.yml?label=test&branch=master&logo=github&style=flat-square"></a>
|
||||||
<a href="https://codecov.io/gh/goreleaser/goreleaser-action"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/goreleaser/goreleaser-action?logo=codecov&style=flat-square"></a>
|
<a href="https://codecov.io/gh/goreleaser/goreleaser-action"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/goreleaser/goreleaser-action?logo=codecov&style=flat-square"></a>
|
||||||
</p>
|
</p>
|
||||||
</p>
|
</p>
|
||||||
@@ -30,6 +30,12 @@ ___
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
GoReleaser Action runs [goreleaser][], please follow its [docs][gdocs] for
|
||||||
|
more information about how to customize what GoReleaser do.
|
||||||
|
|
||||||
|
[goreleaser]: https://goreleaser.com/
|
||||||
|
[gdocs]: https://goreleaser.com/customization
|
||||||
|
|
||||||
### Workflow
|
### Workflow
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -39,26 +45,29 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
|
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
|
||||||
@@ -83,11 +92,11 @@ Or with a condition on GoReleaser step:
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@v4
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
@@ -109,10 +118,10 @@ the [Import GPG](https://github.com/crazy-max/ghaction-import-gpg) GitHub Action
|
|||||||
passphrase: ${{ secrets.PASSPHRASE }}
|
passphrase: ${{ secrets.PASSPHRASE }}
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
@@ -134,10 +143,11 @@ purpose. You can do that with the [actions/upload-artifact](https://github.com/a
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --clean
|
||||||
|
workdir: myfolder
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
@@ -145,7 +155,7 @@ purpose. You can do that with the [actions/upload-artifact](https://github.com/a
|
|||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: myapp
|
name: myapp
|
||||||
path: dist/*
|
path: myfolder/dist/*
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install Only
|
### Install Only
|
||||||
@@ -154,7 +164,7 @@ purpose. You can do that with the [actions/upload-artifact](https://github.com/a
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Install GoReleaser
|
name: Install GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
install-only: true
|
install-only: true
|
||||||
-
|
-
|
||||||
@@ -182,18 +192,18 @@ Following inputs can be used as `step.with` keys
|
|||||||
|
|
||||||
Following outputs are available
|
Following outputs are available
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|-------------------|---------|---------------------------------------|
|
|-------------|------|------------------------|
|
||||||
| `artifacts` | JSON | Build result artifacts |
|
| `artifacts` | JSON | Build result artifacts |
|
||||||
| `metadata` | JSON | Build result metadata |
|
| `metadata` | JSON | Build result metadata |
|
||||||
|
|
||||||
### environment variables
|
### environment variables
|
||||||
|
|
||||||
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` and requires `contents:write` |
|
||||||
| `GORELEASER_KEY` | Your [GoReleaser Pro](https://goreleaser.com/pro) License Key, in case you are using the `goreleaser-pro` distribution |
|
| `GORELEASER_KEY` | Your [GoReleaser Pro](https://goreleaser.com/pro) License Key, in case you are using the `goreleaser-pro` distribution |
|
||||||
|
|
||||||
## Limitation
|
## Limitation
|
||||||
@@ -208,14 +218,18 @@ secret named `GH_PAT`, the step will look like this:
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Migrating from v3
|
||||||
|
|
||||||
|
If you need the auto-snapshot feature, take a look at [this example repository](https://github.com/caarlos0/goreleaser-action-v4-auto-snapshot-example): it's a minimal working example with all you need.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import {describe, expect, it} from '@jest/globals';
|
|
||||||
import * as git from '../src/git';
|
|
||||||
|
|
||||||
describe('git', () => {
|
|
||||||
it('returns git tag through describe', async () => {
|
|
||||||
process.env.GITHUB_SHA = '309312125ed7a32fcd48f3a1e24dcafe669c186a';
|
|
||||||
const tag: string = await git.getTag();
|
|
||||||
expect(tag).not.toEqual('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns git tag through GITHUB_SHA', async () => {
|
|
||||||
process.env.GITHUB_SHA = '6389ff5bd287fd6948a7ccda8af8da4f0bbc856a';
|
|
||||||
const tag: string = await git.getTag();
|
|
||||||
expect(tag).toEqual('v2.2.1');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns git tag through GITHUB_REF', async () => {
|
|
||||||
process.env.GITHUB_REF = 'refs/tags/v2.2.1';
|
|
||||||
const tag: string = await git.getTag();
|
|
||||||
expect(tag).toEqual('v2.2.1');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checks if tag is dirty', async () => {
|
|
||||||
expect(await git.isTagDirty('v1.3.1')).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns short commit', async () => {
|
|
||||||
const commit: string = await git.getShortCommit();
|
|
||||||
expect(commit).not.toEqual('');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import {describe, expect, it} from '@jest/globals';
|
import {describe, expect, it} from '@jest/globals';
|
||||||
import * as github from '../src/github';
|
import * as github from '../src/github';
|
||||||
|
|
||||||
describe('github', () => {
|
describe('getRelease', () => {
|
||||||
it('returns latest GoReleaser GitHub release', async () => {
|
it('returns latest GoReleaser GitHub release', async () => {
|
||||||
const release = await github.getRelease('goreleaser', 'latest');
|
const release = await github.getRelease('goreleaser', 'latest');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
@@ -20,21 +20,45 @@ describe('github', () => {
|
|||||||
expect(release?.tag_name).toEqual('v0.182.1');
|
expect(release?.tag_name).toEqual('v0.182.1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('unknown GoReleaser release', async () => {
|
||||||
|
await expect(github.getRelease('goreleaser', 'foo')).rejects.toThrow(
|
||||||
|
new Error('Cannot find GoReleaser release foo in https://goreleaser.com/static/releases.json')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('returns latest GoReleaser Pro GitHub release', async () => {
|
it('returns latest GoReleaser Pro GitHub release', async () => {
|
||||||
const release = await github.getRelease('goreleaser-pro', 'latest');
|
const release = await github.getRelease('goreleaser-pro', 'latest');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).not.toEqual('');
|
expect(release?.tag_name).not.toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns v0.182.0-pro GoReleaser Pro GitHub release', async () => {
|
it('returns nightly GoReleaser GitHub release', async () => {
|
||||||
const release = await github.getRelease('goreleaser-pro', 'v0.182.0-pro');
|
const release = await github.getRelease('goreleaser', 'nightly');
|
||||||
|
expect(release).not.toBeNull();
|
||||||
|
expect(release?.tag_name).not.toEqual('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns nightly GoReleaser Pro GitHub release', async () => {
|
||||||
|
const release = await github.getRelease('goreleaser-pro', 'nightly');
|
||||||
|
expect(release).not.toBeNull();
|
||||||
|
expect(release?.tag_name).not.toEqual('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns v0.182.0 GoReleaser Pro GitHub release', async () => {
|
||||||
|
const release = await github.getRelease('goreleaser-pro', 'v0.182.0');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).toEqual('v0.182.0-pro');
|
expect(release?.tag_name).toEqual('v0.182.0-pro');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns v0.182.1-pro GoReleaser Pro GitHub release when using semver', async () => {
|
it('returns v0.182.1 GoReleaser Pro GitHub release', async () => {
|
||||||
const release = await github.getRelease('goreleaser-pro', '~> 0.182');
|
const release = await github.getRelease('goreleaser-pro', '~> 0.182');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).toEqual('v0.182.1-pro');
|
expect(release?.tag_name).toEqual('v0.182.1-pro');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('unknown GoReleaser Pro release', async () => {
|
||||||
|
await expect(github.getRelease('goreleaser-pro', 'foo')).rejects.toThrow(
|
||||||
|
new Error('Cannot find GoReleaser release foo-pro in https://goreleaser.com/static/releases-pro.json')
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+23
-17
@@ -4,10 +4,12 @@ ARG NODE_VERSION=16
|
|||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
RUN apk add --no-cache cpio findutils git
|
RUN apk add --no-cache cpio findutils git
|
||||||
|
RUN yarn config set --home enableTelemetry 0
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
||||||
|
|
||||||
@@ -16,18 +18,19 @@ COPY --from=deps /vendor /
|
|||||||
|
|
||||||
FROM deps AS vendor-validate
|
FROM deps AS vendor-validate
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
RUN --mount=type=bind,target=.,rw <<EOT
|
||||||
set -e
|
set -e
|
||||||
git add -A
|
git add -A
|
||||||
cp -rf /vendor/* .
|
cp -rf /vendor/* .
|
||||||
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
||||||
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
|
||||||
git status --porcelain -- yarn.lock
|
git status --porcelain -- yarn.lock
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM deps AS build
|
FROM deps AS build
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run build && mkdir /out && cp -Rf dist /out/
|
yarn run build && mkdir /out && cp -Rf dist /out/
|
||||||
|
|
||||||
@@ -36,27 +39,29 @@ COPY --from=build /out /
|
|||||||
|
|
||||||
FROM build AS build-validate
|
FROM build AS build-validate
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
RUN --mount=type=bind,target=.,rw <<EOT
|
||||||
set -e
|
set -e
|
||||||
git add -A
|
git add -A
|
||||||
cp -rf /out/* .
|
cp -rf /out/* .
|
||||||
if [ -n "$(git status --porcelain -- dist)" ]; then
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||||
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
||||||
git status --porcelain -- dist
|
git status --porcelain -- dist
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM deps AS format
|
FROM deps AS format
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run format \
|
yarn run format \
|
||||||
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
|
||||||
|
|
||||||
FROM scratch AS format-update
|
FROM scratch AS format-update
|
||||||
COPY --from=format /out /
|
COPY --from=format /out /
|
||||||
|
|
||||||
FROM deps AS lint
|
FROM deps AS lint
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run lint
|
yarn run lint
|
||||||
|
|
||||||
@@ -64,6 +69,7 @@ FROM deps AS test
|
|||||||
ENV RUNNER_TEMP=/tmp/github_runner
|
ENV RUNNER_TEMP=/tmp/github_runner
|
||||||
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/.yarn/cache \
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run test --coverageDirectory=/tmp/coverage
|
yarn run test --coverageDirectory=/tmp/coverage
|
||||||
|
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+38
@@ -236,6 +236,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
lru-cache
|
||||||
|
ISC
|
||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
require-directory
|
require-directory
|
||||||
MIT
|
MIT
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
@@ -375,6 +394,25 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
yallist
|
||||||
|
ISC
|
||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
yargs
|
yargs
|
||||||
MIT
|
MIT
|
||||||
MIT License
|
MIT License
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ group "default" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group "pre-checkin" {
|
group "pre-checkin" {
|
||||||
targets = ["vendor-update", "format", "build"]
|
targets = ["vendor", "format", "build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
@@ -34,7 +34,7 @@ target "lint" {
|
|||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-update" {
|
target "vendor" {
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "vendor-update"
|
target = "vendor-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
|
|||||||
+21
-20
@@ -1,13 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "goreleaser-action",
|
"name": "goreleaser-action",
|
||||||
"description": "GitHub Action for GoReleaser, a release automation tool for Go projects",
|
"description": "GitHub Action for GoReleaser, a release automation tool for Go projects",
|
||||||
"main": "lib/main.js",
|
"main": "src/main.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
"build": "ncc build --source-map --minify --license licenses.txt",
|
||||||
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
|
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
|
||||||
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
|
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
|
||||||
"test": "jest --coverage",
|
"test": "jest --coverage"
|
||||||
"all": "yarn run build && yarn run format && yarn test"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -20,29 +19,31 @@
|
|||||||
],
|
],
|
||||||
"author": "CrazyMax",
|
"author": "CrazyMax",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"packageManager": "yarn@3.5.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.1.1",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"yargs": "^17.6.0"
|
"semver": "^7.5.4",
|
||||||
|
"yargs": "^17.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.26",
|
"@types/node": "^16.18.26",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
||||||
"@typescript-eslint/parser": "^5.14.0",
|
"@typescript-eslint/parser": "^5.59.2",
|
||||||
"@vercel/ncc": "^0.33.3",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"dotenv": "^16.0.0",
|
"dotenv": "^16.0.3",
|
||||||
"eslint": "^8.11.0",
|
"eslint": "^8.40.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-jest": "^26.1.1",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"jest": "^27.2.5",
|
"jest": "^29.5.0",
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^2.8.8",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"ts-jest": "^27.1.2",
|
"ts-jest": "^29.1.0",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.4.4"
|
"typescript": "^4.9.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ export interface Inputs {
|
|||||||
export async function getInputs(): Promise<Inputs> {
|
export async function getInputs(): Promise<Inputs> {
|
||||||
return {
|
return {
|
||||||
distribution: core.getInput('distribution') || 'goreleaser',
|
distribution: core.getInput('distribution') || 'goreleaser',
|
||||||
version: core.getInput('version'),
|
version: core.getInput('version') || 'latest',
|
||||||
args: core.getInput('args'),
|
args: core.getInput('args'),
|
||||||
workdir: core.getInput('workdir') || '.',
|
workdir: core.getInput('workdir') || '.',
|
||||||
installOnly: core.getBooleanInput('install-only')
|
installOnly: core.getBooleanInput('install-only')
|
||||||
|
|||||||
-49
@@ -1,49 +0,0 @@
|
|||||||
import * as exec from '@actions/exec';
|
|
||||||
|
|
||||||
const git = async (args: string[] = []): Promise<string> => {
|
|
||||||
return await exec
|
|
||||||
.getExecOutput(`git`, args, {
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
silent: true
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
throw new Error(res.stderr);
|
|
||||||
}
|
|
||||||
return res.stdout.trim();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function getTag(): Promise<string> {
|
|
||||||
try {
|
|
||||||
if ((process.env.GITHUB_REF || '').startsWith('refs/tags')) {
|
|
||||||
const tag = (process.env.GITHUB_REF || '').split('/').pop();
|
|
||||||
if (tag !== '' && tag !== undefined) {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return await git(['tag', '--points-at', `${process.env.GITHUB_SHA}`, '--sort', '-version:creatordate']).then(
|
|
||||||
tags => {
|
|
||||||
if (tags.length == 0) {
|
|
||||||
return git(['describe', '--tags', '--abbrev=0']);
|
|
||||||
}
|
|
||||||
return tags.split('\n')[0];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch (err) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function isTagDirty(currentTag: string): Promise<boolean> {
|
|
||||||
try {
|
|
||||||
await git(['describe', '--exact-match', '--tags', '--match', currentTag]);
|
|
||||||
} catch (err) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getShortCommit(): Promise<string> {
|
|
||||||
return await git(['show', "--format='%h'", 'HEAD', '--quiet']);
|
|
||||||
}
|
|
||||||
+43
-10
@@ -4,28 +4,60 @@ import * as core from '@actions/core';
|
|||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
|
|
||||||
export interface GitHubRelease {
|
export interface GitHubRelease {
|
||||||
id: number;
|
|
||||||
tag_name: string;
|
tag_name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease | null> => {
|
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
|
||||||
const resolvedVersion: string = (await resolveVersion(distribution, version)) || version;
|
if (version === 'latest') {
|
||||||
const url = `https://github.com/goreleaser/${distribution}/releases/${resolvedVersion}`;
|
return getLatestRelease(distribution);
|
||||||
|
}
|
||||||
|
return getReleaseTag(distribution, version);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getReleaseTag = async (distribution: string, version: string): Promise<GitHubRelease> => {
|
||||||
|
if (version === 'nightly') {
|
||||||
|
return {tag_name: version};
|
||||||
|
}
|
||||||
|
const tag: string = (await resolveVersion(distribution, version)) || version;
|
||||||
|
const suffix: string = goreleaser.distribSuffix(distribution);
|
||||||
|
const url = `https://goreleaser.com/static/releases${suffix}.json`;
|
||||||
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;
|
const resp: httpm.HttpClientResponse = await http.get(url);
|
||||||
|
const body = await resp.readBody();
|
||||||
|
const statusCode = resp.message.statusCode || 500;
|
||||||
|
if (statusCode >= 400) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to get GoReleaser release ${version}${suffix} from ${url} with status code ${statusCode}: ${body}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const releases = <Array<GitHubRelease>>JSON.parse(body);
|
||||||
|
const res = releases.filter(r => r.tag_name === tag).shift();
|
||||||
|
if (res) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(`Cannot find GoReleaser release ${version}${suffix} in ${url}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getLatestRelease = async (distribution: string): Promise<GitHubRelease> => {
|
||||||
|
const suffix: string = goreleaser.distribSuffix(distribution);
|
||||||
|
const url = `https://goreleaser.com/static/latest${suffix}`;
|
||||||
|
const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action');
|
||||||
|
const resp: httpm.HttpClientResponse = await http.get(url);
|
||||||
|
const body = await resp.readBody();
|
||||||
|
const statusCode = resp.message.statusCode || 500;
|
||||||
|
if (statusCode >= 400) {
|
||||||
|
throw new Error(`Failed to get GoReleaser release latest from ${url} with status code ${statusCode}: ${body}`);
|
||||||
|
}
|
||||||
|
return {tag_name: body};
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
||||||
const allTags: Array<string> | null = await getAllTags(distribution);
|
const allTags: Array<string> | null = await getAllTags(distribution);
|
||||||
if (!allTags) {
|
if (!allTags) {
|
||||||
throw new Error(`Cannot find GoReleaser tags`);
|
throw new Error(`Cannot download ${distribution} tags`);
|
||||||
}
|
}
|
||||||
core.debug(`Found ${allTags.length} tags in total`);
|
core.debug(`Found ${allTags.length} tags in total`);
|
||||||
|
|
||||||
if (version === 'latest' || !goreleaser.isPro(distribution)) {
|
|
||||||
return semver.maxSatisfying(allTags, version);
|
|
||||||
}
|
|
||||||
|
|
||||||
const cleanTags: Array<string> = allTags.map(tag => cleanTag(tag));
|
const cleanTags: Array<string> = allTags.map(tag => cleanTag(tag));
|
||||||
const cleanVersion: string = cleanTag(version);
|
const cleanVersion: string = cleanTag(version);
|
||||||
return semver.maxSatisfying(cleanTags, cleanVersion) + goreleaser.distribSuffix(distribution);
|
return semver.maxSatisfying(cleanTags, cleanVersion) + goreleaser.distribSuffix(distribution);
|
||||||
@@ -39,6 +71,7 @@ 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 suffix: string = goreleaser.distribSuffix(distribution);
|
const suffix: string = goreleaser.distribSuffix(distribution);
|
||||||
const url = `https://goreleaser.com/static/releases${suffix}.json`;
|
const url = `https://goreleaser.com/static/releases${suffix}.json`;
|
||||||
|
core.debug(`Downloading ${url}`);
|
||||||
const getTags = http.getJson<Array<GitHubTag>>(url);
|
const getTags = http.getJson<Array<GitHubTag>>(url);
|
||||||
return getTags.then(response => {
|
return getTags.then(response => {
|
||||||
if (response.result == null) {
|
if (response.result == null) {
|
||||||
|
|||||||
+9
-6
@@ -8,11 +8,7 @@ import * as core from '@actions/core';
|
|||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
|
|
||||||
export async function install(distribution: string, version: string): Promise<string> {
|
export async function install(distribution: string, version: string): Promise<string> {
|
||||||
const release: github.GitHubRelease | null = await github.getRelease(distribution, version);
|
const release: github.GitHubRelease = await github.getRelease(distribution, version);
|
||||||
if (!release) {
|
|
||||||
throw new Error(`Cannot find GoReleaser ${version} release`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const filename = getFilename(distribution);
|
const filename = getFilename(distribution);
|
||||||
const downloadUrl = util.format(
|
const downloadUrl = util.format(
|
||||||
'https://github.com/goreleaser/%s/releases/download/%s/%s',
|
'https://github.com/goreleaser/%s/releases/download/%s/%s',
|
||||||
@@ -28,7 +24,13 @@ export async function install(distribution: string, version: string): Promise<st
|
|||||||
core.info('Extracting GoReleaser');
|
core.info('Extracting GoReleaser');
|
||||||
let extPath: string;
|
let extPath: string;
|
||||||
if (context.osPlat == 'win32') {
|
if (context.osPlat == 'win32') {
|
||||||
extPath = await tc.extractZip(downloadPath);
|
if (!downloadPath.endsWith('.zip')) {
|
||||||
|
const newPath = downloadPath + '.zip';
|
||||||
|
fs.renameSync(downloadPath, newPath);
|
||||||
|
extPath = await tc.extractZip(newPath);
|
||||||
|
} else {
|
||||||
|
extPath = await tc.extractZip(downloadPath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
extPath = await tc.extractTar(downloadPath);
|
extPath = await tc.extractTar(downloadPath);
|
||||||
}
|
}
|
||||||
@@ -63,6 +65,7 @@ const getFilename = (distribution: string): string => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'arm': {
|
case 'arm': {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const arm_version = (process.config.variables as any).arm_version;
|
const arm_version = (process.config.variables as any).arm_version;
|
||||||
arch = arm_version ? 'armv' + arm_version : 'arm';
|
arch = arm_version ? 'armv' + arm_version : 'arm';
|
||||||
break;
|
break;
|
||||||
|
|||||||
+2
-25
@@ -2,7 +2,6 @@ import * as fs from 'fs';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import * as context from './context';
|
import * as context from './context';
|
||||||
import * as git from './git';
|
|
||||||
import * as goreleaser from './goreleaser';
|
import * as goreleaser from './goreleaser';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
@@ -28,12 +27,8 @@ async function run(): Promise<void> {
|
|||||||
process.chdir(inputs.workdir);
|
process.chdir(inputs.workdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
const commit = await git.getShortCommit();
|
|
||||||
const tag = await git.getTag();
|
|
||||||
const isTagDirty = await git.isTagDirty(tag);
|
|
||||||
|
|
||||||
let yamlfile: string | unknown;
|
let yamlfile: string | unknown;
|
||||||
const argv = yargs.parse(inputs.args);
|
const argv: {config: string} = yargs.parse(inputs.args) as never;
|
||||||
if (argv.config) {
|
if (argv.config) {
|
||||||
yamlfile = argv.config;
|
yamlfile = argv.config;
|
||||||
} else {
|
} else {
|
||||||
@@ -44,25 +39,7 @@ async function run(): Promise<void> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let snapshot = '';
|
await exec.exec(`${bin} ${inputs.args}`);
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (typeof yamlfile === 'string') {
|
if (typeof yamlfile === 'string') {
|
||||||
const artifacts = await goreleaser.getArtifacts(await goreleaser.getDistPath(yamlfile));
|
const artifacts = await goreleaser.getArtifacts(await goreleaser.getDistPath(yamlfile));
|
||||||
|
|||||||
@@ -14,14 +14,11 @@ builds:
|
|||||||
- linux
|
- linux
|
||||||
- windows
|
- windows
|
||||||
goarch:
|
goarch:
|
||||||
- 386
|
- "386"
|
||||||
- amd64
|
- "amd64"
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
-
|
-
|
||||||
replacements:
|
|
||||||
386: i386
|
|
||||||
amd64: x86_64
|
|
||||||
format_overrides:
|
format_overrides:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
format: zip
|
||||||
|
|||||||
@@ -14,14 +14,11 @@ builds:
|
|||||||
- linux
|
- linux
|
||||||
- windows
|
- windows
|
||||||
goarch:
|
goarch:
|
||||||
- 386
|
- "386"
|
||||||
- amd64
|
- "amd64"
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
-
|
-
|
||||||
replacements:
|
|
||||||
386: i386
|
|
||||||
amd64: x86_64
|
|
||||||
format_overrides:
|
format_overrides:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
format: zip
|
||||||
|
|||||||
Reference in New Issue
Block a user