Compare commits

..
2 Commits
Author SHA1 Message Date
Carlos Alexandro Becker b4b0533a52 Merge remote-tracking branch 'origin/master' into semver
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-05-08 16:11:17 -03:00
Carlos Alexandro Becker b885aa77a9 feat: warn about using 'latest' 2024-04-27 12:13:40 -03:00
14 changed files with 123 additions and 102 deletions
+10 -10
View File
@@ -28,7 +28,7 @@ jobs:
- windows-latest
version:
- latest
- '~> 1.26'
- '~> 1.15'
distribution:
- goreleaser
- goreleaser-pro
@@ -48,7 +48,7 @@ jobs:
uses: ./
with:
version: ${{ matrix.version }}
args: check --verbose
args: check --debug
workdir: ./test
-
name: GoReleaser
@@ -59,7 +59,7 @@ jobs:
with:
distribution: ${{ matrix.distribution }}
version: ${{ matrix.version }}
args: release --skip=publish --clean --snapshot
args: release --skip-publish --clean --snapshot
workdir: ./test
install-only:
@@ -69,7 +69,7 @@ jobs:
matrix:
version:
- latest
- '~> 1.26'
- '~> 0.166'
distribution:
- goreleaser
- goreleaser-pro
@@ -96,7 +96,7 @@ jobs:
name: Check
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
run: |
goreleaser check --verbose
goreleaser check --debug
signing:
runs-on: ${{ matrix.os }}
@@ -131,7 +131,7 @@ jobs:
uses: ./
with:
version: latest
args: -f .goreleaser-signing.yml check --verbose
args: -f .goreleaser-signing.yml check --debug
workdir: ./test
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
@@ -140,7 +140,7 @@ jobs:
uses: ./
with:
version: latest
args: -f .goreleaser-signing.yml release --skip=publish --clean --snapshot
args: -f .goreleaser-signing.yml release --skip-publish --clean --snapshot
workdir: ./test
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
@@ -162,13 +162,13 @@ jobs:
name: Check
uses: ./
with:
args: check --verbose
args: check --debug
workdir: ./test
-
name: GoReleaser
uses: ./
with:
args: release --skip=publish --clean --snapshot
args: release --skip-publish --clean --snapshot
workdir: ./test
-
name: Upload assets
@@ -194,7 +194,7 @@ jobs:
name: GoReleaser
uses: ./
with:
args: release --config .goreleaser-dist.yml --skip=publish --clean --snapshot
args: release --config .goreleaser-dist.yml --skip-publish --clean --snapshot
workdir: ./test
-
name: Check dist
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
fetch-depth: 0
-
name: Test
uses: docker/bake-action@v5
uses: docker/bake-action@v4
with:
targets: test
-
+1 -1
View File
@@ -40,6 +40,6 @@ jobs:
uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v5
uses: docker/bake-action@v4
with:
targets: ${{ matrix.target }}
+16 -16
View File
@@ -31,7 +31,7 @@ ___
## Usage
GoReleaser Action runs [goreleaser][], please follow its [docs][gdocs] for
more information about how to customize what GoReleaser does.
more information about how to customize what GoReleaser do.
[goreleaser]: https://goreleaser.com/
[gdocs]: https://goreleaser.com/customization
@@ -59,15 +59,15 @@ jobs:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v4
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: '~> v2'
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -93,10 +93,10 @@ Or with a condition on GoReleaser step:
```yaml
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
version: '~> v2'
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -119,9 +119,9 @@ the [Import GPG](https://github.com/crazy-max/ghaction-import-gpg) GitHub Action
passphrase: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
with:
version: '~> v2'
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -139,21 +139,21 @@ signs:
### Upload artifacts
For some events like pull request or schedule you might want to store the artifacts somewhere for testing
purposes. You can do that with the [actions/upload-artifact](https://github.com/actions/upload-artifact) action:
purpose. You can do that with the [actions/upload-artifact](https://github.com/actions/upload-artifact) action:
```yaml
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
with:
version: '~> v2'
version: latest
args: release --clean
workdir: myfolder
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Upload assets
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: myapp
path: myfolder/dist/*
@@ -165,7 +165,7 @@ purposes. You can do that with the [actions/upload-artifact](https://github.com/
steps:
-
name: Install GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
with:
install-only: true
-
@@ -182,7 +182,7 @@ Following inputs can be used as `step.with` keys
| Name | Type | Default | Description |
|------------------|---------|--------------|------------------------------------------------------------------|
| `distribution` | String | `goreleaser` | GoReleaser distribution, either `goreleaser` or `goreleaser-pro` |
| `version`**¹** | String | `~> v2` | GoReleaser version |
| `version`**¹** | String | `latest` | GoReleaser version |
| `args` | String | | Arguments to pass to GoReleaser |
| `workdir` | String | `.` | Working directory (below repository root) |
| `install-only` | Bool | `false` | Just install GoReleaser |
@@ -219,9 +219,9 @@ secret named `GH_PAT`, the step will look like this:
```yaml
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
with:
version: '~> v2'
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
-24
View File
@@ -32,30 +32,6 @@ describe('getRelease', () => {
expect(release?.tag_name).not.toEqual('');
});
it('returns latest v1 GoReleaser Pro GitHub release', async () => {
const release = await github.getRelease('goreleaser-pro', '~> v1');
expect(release).not.toBeNull();
expect(release?.tag_name).not.toEqual('');
});
it('returns latest v1 GoReleaser GitHub release', async () => {
const release = await github.getRelease('goreleaser', '~> v1');
expect(release).not.toBeNull();
expect(release?.tag_name).not.toEqual('');
});
it('returns latest v2 GoReleaser Pro GitHub release', async () => {
const release = await github.getRelease('goreleaser-pro', '~> v2');
expect(release).not.toBeNull();
expect(release?.tag_name).not.toEqual('');
});
it('returns latest v2 GoReleaser GitHub release', async () => {
const release = await github.getRelease('goreleaser', '~> v2');
expect(release).not.toBeNull();
expect(release?.tag_name).not.toEqual('');
});
it('returns nightly GoReleaser GitHub release', async () => {
const release = await github.getRelease('goreleaser', 'nightly');
expect(release).not.toBeNull();
-10
View File
@@ -28,16 +28,6 @@ describe('install', () => {
expect(fs.existsSync(bin)).toBe(true);
}, 100000);
it('acquires latest v2 version of GoReleaser', async () => {
const bin = await goreleaser.install('goreleaser', '~> v2');
expect(fs.existsSync(bin)).toBe(true);
}, 100000);
it('acquires latest v2 version of GoReleaser Pro', async () => {
const bin = await goreleaser.install('goreleaser-pro', '~> v2');
expect(fs.existsSync(bin)).toBe(true);
}, 100000);
it('acquires latest version of GoReleaser Pro', async () => {
const bin = await goreleaser.install('goreleaser-pro', 'latest');
expect(fs.existsSync(bin)).toBe(true);
+1 -1
View File
@@ -13,7 +13,7 @@ inputs:
required: false
version:
description: 'GoReleaser version'
default: '~> v2'
default: 'latest'
required: false
args:
description: 'Arguments to pass to GoReleaser'
Generated Vendored
+3 -3
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+38
View File
@@ -258,6 +258,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
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
MIT
The MIT License (MIT)
@@ -422,6 +441,25 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
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
MIT
MIT License
+3 -3
View File
@@ -26,12 +26,12 @@
"license": "MIT",
"packageManager": "yarn@3.6.3",
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/http-client": "^2.2.3",
"@actions/http-client": "^2.2.1",
"@actions/tool-cache": "^2.0.1",
"js-yaml": "^4.1.0",
"semver": "^7.6.3",
"semver": "^7.6.0",
"yargs": "^17.7.2"
},
"devDependencies": {
+1 -1
View File
@@ -15,7 +15,7 @@ export interface Inputs {
export async function getInputs(): Promise<Inputs> {
return {
distribution: core.getInput('distribution') || 'goreleaser',
version: core.getInput('version') || '~> v2',
version: core.getInput('version') || 'latest',
args: core.getInput('args'),
workdir: core.getInput('workdir') || '.',
installOnly: core.getBooleanInput('install-only')
+17 -2
View File
@@ -9,8 +9,10 @@ export interface GitHubRelease {
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
if (version === 'latest') {
core.warning("You are using 'latest' as default version. Will lock to '~> v2'.");
return getReleaseTag(distribution, '~> v2');
core.warning(
"You are using 'latest' as default version. This might include breaking changes. It is recommended to use a SemVer to lock to a major version (e.g. ~> v1)."
);
return getLatestRelease(distribution);
}
return getReleaseTag(distribution, version);
};
@@ -39,6 +41,19 @@ export const getReleaseTag = async (distribution: string, version: string): Prom
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 allTags: Array<string> | null = await getAllTags(distribution);
if (!allTags) {
+31 -29
View File
@@ -12,13 +12,13 @@ __metadata:
languageName: node
linkType: hard
"@actions/core@npm:^1.11.1":
version: 1.11.1
resolution: "@actions/core@npm:1.11.1"
"@actions/core@npm:^1.10.1":
version: 1.10.1
resolution: "@actions/core@npm:1.10.1"
dependencies:
"@actions/exec": ^1.1.1
"@actions/http-client": ^2.0.1
checksum: 9ac7a3e0b478bfefd862dcb4ddaa1d8c3f9076bb1931d3d280918d1749e7783480c6a009c1b009c8bf5093e2d77d9f4e023d70416145bf246f0071736d4ef839
uuid: ^8.3.2
checksum: 96524c2725e70e3c3176b4e4d93a1358a86f3c5ca777db9a2f65eadfa672f00877db359bf60fffc416c33838ffb4743db93bcc5bf53e76199dd28bf7f7ff8e80
languageName: node
linkType: hard
@@ -50,13 +50,13 @@ __metadata:
languageName: node
linkType: hard
"@actions/http-client@npm:^2.2.3":
version: 2.2.3
resolution: "@actions/http-client@npm:2.2.3"
"@actions/http-client@npm:^2.2.1":
version: 2.2.1
resolution: "@actions/http-client@npm:2.2.1"
dependencies:
tunnel: ^0.0.6
undici: ^5.25.4
checksum: 5d395df575d30ae599efa10dd715e72944b015e753db61f0a823f737acbb0e99743d4a9f25e812b18ec8cc34f86c73565d075c449e01ffa891577b6595212dde
checksum: c51c003cd697289136c0e81c0f9b8e57a9bb1a038dc7c9a91a71c02f4ae5e27ef7d3e305aefa7c815604049209d114c06e9991a5c5eaa055508519329267f962
languageName: node
linkType: hard
@@ -1992,12 +1992,12 @@ __metadata:
languageName: node
linkType: hard
"braces@npm:^3.0.3":
version: 3.0.3
resolution: "braces@npm:3.0.3"
"braces@npm:^3.0.2":
version: 3.0.2
resolution: "braces@npm:3.0.2"
dependencies:
fill-range: ^7.1.1
checksum: b95aa0b3bd909f6cd1720ffcf031aeaf46154dd88b4da01f9a1d3f7ea866a79eba76a6d01cbc3c422b2ee5cdc39a4f02491058d5df0d7bf6e6a162a832df1f69
fill-range: ^7.0.1
checksum: e2a8e769a863f3d4ee887b5fe21f63193a891c68b612ddb4b68d82d1b5f3ff9073af066c343e9867a393fe4c2555dcb33e89b937195feb9c1613d259edfcd459
languageName: node
linkType: hard
@@ -2878,12 +2878,12 @@ __metadata:
languageName: node
linkType: hard
"fill-range@npm:^7.1.1":
version: 7.1.1
resolution: "fill-range@npm:7.1.1"
"fill-range@npm:^7.0.1":
version: 7.0.1
resolution: "fill-range@npm:7.0.1"
dependencies:
to-regex-range: ^5.0.1
checksum: b4abfbca3839a3d55e4ae5ec62e131e2e356bf4859ce8480c64c4876100f4df292a63e5bb1618e1d7460282ca2b305653064f01654474aa35c68000980f17798
checksum: cc283f4e65b504259e64fd969bcf4def4eb08d85565e906b7d36516e87819db52029a76b6363d0f02d0d532f0033c9603b9e2d943d56ee3b0d4f7ad3328ff917
languageName: node
linkType: hard
@@ -3089,9 +3089,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "goreleaser-action@workspace:."
dependencies:
"@actions/core": ^1.11.1
"@actions/core": ^1.10.1
"@actions/exec": ^1.1.1
"@actions/http-client": ^2.2.3
"@actions/http-client": ^2.2.1
"@actions/tool-cache": ^2.0.1
"@types/node": ^20.6.0
"@typescript-eslint/eslint-plugin": ^6.6.0
@@ -3105,7 +3105,7 @@ __metadata:
jest: ^29.6.4
js-yaml: ^4.1.0
prettier: ^3.0.3
semver: ^7.6.3
semver: ^7.6.0
tmp: ^0.2.1
ts-jest: ^29.1.1
ts-node: ^10.9.1
@@ -4186,12 +4186,12 @@ __metadata:
linkType: hard
"micromatch@npm:^4.0.4":
version: 4.0.8
resolution: "micromatch@npm:4.0.8"
version: 4.0.5
resolution: "micromatch@npm:4.0.5"
dependencies:
braces: ^3.0.3
braces: ^3.0.2
picomatch: ^2.3.1
checksum: 79920eb634e6f400b464a954fcfa589c4e7c7143209488e44baf627f9affc8b1e306f41f4f0deedde97e69cb725920879462d3e750ab3bd3c1aed675bb3a8966
checksum: 02a17b671c06e8fefeeb6ef996119c1e597c942e632a21ef589154f23898c9c6a9858526246abb14f8bca6e77734aa9dcf65476fca47cedfb80d9577d52843fc
languageName: node
linkType: hard
@@ -4895,12 +4895,14 @@ __metadata:
languageName: node
linkType: hard
"semver@npm:^7.6.3":
version: 7.6.3
resolution: "semver@npm:7.6.3"
"semver@npm:^7.6.0":
version: 7.6.0
resolution: "semver@npm:7.6.0"
dependencies:
lru-cache: ^6.0.0
bin:
semver: bin/semver.js
checksum: 4110ec5d015c9438f322257b1c51fe30276e5f766a3f64c09edd1d7ea7118ecbc3f379f3b69032bacf13116dc7abc4ad8ce0d7e2bd642e26b0d271b56b61a7d8
checksum: 7427f05b70786c696640edc29fdd4bc33b2acf3bbe1740b955029044f80575fc664e1a512e4113c3af21e767154a94b4aa214bf6cd6e42a1f6dba5914e0b208c
languageName: node
linkType: hard