mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-29 13:48:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcd4e58dba | ||
|
|
57e184bc5a | ||
|
|
ed0d97425c | ||
|
|
f06c13b6b1 | ||
|
|
d3934597ca | ||
|
|
ee731b1700 | ||
|
|
55de448558 | ||
|
|
a4f614e65e | ||
|
|
d2d17a6c5d | ||
|
|
d13def3a6e | ||
|
|
21549b6bea | ||
|
|
47c416d5e8 | ||
|
|
5daf1e915a | ||
|
|
5cc7ebb73d | ||
|
|
702f5f91c9 | ||
|
|
1a80836c5c | ||
|
|
a71152e827 |
+43
-69
@@ -37,25 +37,21 @@ jobs:
|
|||||||
- goreleaser
|
- goreleaser
|
||||||
- goreleaser-pro
|
- goreleaser-pro
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Set up Go
|
||||||
name: Set up Go
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
||||||
with:
|
with:
|
||||||
go-version: stable
|
go-version: stable
|
||||||
-
|
- name: Check
|
||||||
name: Check
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
args: check --verbose
|
args: check --verbose
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
-
|
- name: GoReleaser
|
||||||
name: GoReleaser
|
|
||||||
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
@@ -81,30 +77,25 @@ jobs:
|
|||||||
- true
|
- true
|
||||||
- false
|
- false
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Set up Go
|
||||||
name: Set up Go
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
- name: Install cosign
|
||||||
name: Install cosign
|
|
||||||
if: matrix.cosign
|
if: matrix.cosign
|
||||||
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
|
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
|
||||||
-
|
- name: GoReleaser
|
||||||
name: GoReleaser
|
|
||||||
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
distribution: ${{ matrix.distribution }}
|
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') }}
|
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
|
||||||
run: |
|
run: |
|
||||||
goreleaser check --verbose
|
goreleaser check --verbose
|
||||||
@@ -120,25 +111,21 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Set up Go
|
||||||
name: Set up Go
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
- name: Import GPG key
|
||||||
name: Import GPG key
|
|
||||||
id: import_gpg
|
id: import_gpg
|
||||||
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
|
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
|
||||||
with:
|
with:
|
||||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_TEST }}
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_TEST }}
|
||||||
passphrase: ${{ secrets.PASSPHRASE_TEST }}
|
passphrase: ${{ secrets.PASSPHRASE_TEST }}
|
||||||
-
|
- name: Check
|
||||||
name: Check
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
@@ -146,8 +133,7 @@ jobs:
|
|||||||
workdir: ./test
|
workdir: ./test
|
||||||
env:
|
env:
|
||||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
-
|
- name: GoReleaser
|
||||||
name: GoReleaser
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
@@ -159,31 +145,26 @@ jobs:
|
|||||||
upload-artifact:
|
upload-artifact:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Set up Go
|
||||||
name: Set up Go
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
- name: Check
|
||||||
name: Check
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: check --verbose
|
args: check --verbose
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
-
|
- name: GoReleaser
|
||||||
name: GoReleaser
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: release --skip=publish --clean --snapshot
|
args: release --skip=publish --clean --snapshot
|
||||||
workdir: ./test
|
workdir: ./test
|
||||||
-
|
- name: Upload assets
|
||||||
name: Upload assets
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
||||||
with:
|
with:
|
||||||
name: myapp
|
name: myapp
|
||||||
path: ./test/dist/*
|
path: ./test/dist/*
|
||||||
@@ -191,24 +172,20 @@ jobs:
|
|||||||
dist:
|
dist:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Set up Go
|
||||||
name: Set up Go
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
||||||
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 --clean --snapshot
|
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
|
||||||
|
|
||||||
@@ -225,27 +202,24 @@ jobs:
|
|||||||
- goreleaser-pro
|
- goreleaser-pro
|
||||||
- goreleaser
|
- goreleaser
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Set up Go
|
||||||
name: Set up Go
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
-
|
- name: GoReleaser
|
||||||
name: GoReleaser
|
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
install-only: true
|
install-only: true
|
||||||
distribution: ${{ matrix.distribution }}
|
distribution: ${{ matrix.distribution }}
|
||||||
version: nightly
|
version: nightly
|
||||||
-
|
env:
|
||||||
name: Check
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Check
|
||||||
run: |
|
run: |
|
||||||
goreleaser check -f ./test/.goreleaser.yml
|
goreleaser check -f ./test/.goreleaser.yml
|
||||||
goreleaser --version
|
goreleaser --version
|
||||||
goreleaser --version | grep nightly
|
goreleaser --version | grep nightly
|
||||||
|
|
||||||
|
|||||||
@@ -28,19 +28,15 @@ jobs:
|
|||||||
tag:
|
tag:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Git config
|
||||||
name: Git config
|
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
-
|
- name: Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }}
|
||||||
name: Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }}
|
|
||||||
run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}
|
run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}
|
||||||
-
|
- name: Push
|
||||||
name: Push
|
|
||||||
run: git push origin ${{ github.event.inputs.major_version }} --force
|
run: git push origin ${{ github.event.inputs.major_version }} --force
|
||||||
|
|||||||
+10
-16
@@ -19,30 +19,24 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
- name: Setup Node.js
|
||||||
name: Setup Node.js
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
|
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
-
|
- name: Install cosign
|
||||||
name: Install cosign
|
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
|
||||||
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
|
- name: Install dependencies
|
||||||
-
|
|
||||||
name: Install dependencies
|
|
||||||
run: npm ci
|
run: npm ci
|
||||||
-
|
- name: Test
|
||||||
name: Test
|
|
||||||
run: npm test
|
run: npm test
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
- name: Upload coverage
|
||||||
name: Upload coverage
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||||
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
|
||||||
with:
|
with:
|
||||||
files: ./coverage/clover.xml
|
files: ./coverage/clover.xml
|
||||||
|
|||||||
@@ -19,45 +19,35 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
- name: Setup Node.js
|
||||||
-
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||||
name: Setup Node.js
|
|
||||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
|
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
-
|
- name: Install dependencies
|
||||||
name: Install dependencies
|
|
||||||
run: npm ci
|
run: npm ci
|
||||||
-
|
- name: Format check
|
||||||
name: Format check
|
|
||||||
run: npm run format-check
|
run: npm run format-check
|
||||||
-
|
- name: Lint
|
||||||
name: Lint
|
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
- name: Setup Node.js
|
||||||
-
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6.0.0
|
||||||
name: Setup Node.js
|
|
||||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
|
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
-
|
- name: Install dependencies
|
||||||
name: Install dependencies
|
|
||||||
run: npm ci --ignore-scripts
|
run: npm ci --ignore-scripts
|
||||||
-
|
- name: Rebuild dist
|
||||||
name: Rebuild dist
|
|
||||||
run: npm run build
|
run: npm run build
|
||||||
-
|
- name: Compare dist
|
||||||
name: Compare dist
|
|
||||||
id: diff
|
id: diff
|
||||||
run: |
|
run: |
|
||||||
if [ "$(git diff --ignore-space-at-eol dist | wc -l)" -gt "0" ]; then
|
if [ "$(git diff --ignore-space-at-eol dist | wc -l)" -gt "0" ]; then
|
||||||
@@ -65,10 +55,9 @@ jobs:
|
|||||||
git diff dist
|
git diff dist
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
-
|
- name: Upload built dist on failure
|
||||||
name: Upload built dist on failure
|
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
@@ -76,20 +65,16 @@ jobs:
|
|||||||
vendor:
|
vendor:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
- name: Setup Node.js
|
||||||
-
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6.0.0
|
||||||
name: Setup Node.js
|
|
||||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
|
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
cache: npm
|
||||||
-
|
- name: Refresh package-lock.json
|
||||||
name: Refresh package-lock.json
|
|
||||||
run: npm install --package-lock-only
|
run: npm install --package-lock-only
|
||||||
-
|
- name: Compare package-lock.json
|
||||||
name: Compare package-lock.json
|
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$(git status --porcelain -- package-lock.json)" ]; then
|
if [ -n "$(git status --porcelain -- package-lock.json)" ]; then
|
||||||
echo "package-lock.json is out of sync with package.json. Run 'npm install' and commit." >&2
|
echo "package-lock.json is out of sync with package.json. Run 'npm install' and commit." >&2
|
||||||
|
|||||||
@@ -56,12 +56,10 @@ describe('getRelease', () => {
|
|||||||
expect(release?.tag_name).not.toEqual('');
|
expect(release?.tag_name).not.toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('resolves nightly to the legacy nightly tag for OSS GoReleaser', async () => {
|
it('resolves nightly to a <version>-<sha>-nightly release for OSS GoReleaser', async () => {
|
||||||
// No <version>-<sha>-nightly release exists in goreleaser/goreleaser yet,
|
|
||||||
// so this should fall back to the legacy moving `nightly` tag.
|
|
||||||
const release = await github.getRelease('goreleaser', 'nightly');
|
const release = await github.getRelease('goreleaser', 'nightly');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release.tag_name).toEqual('nightly');
|
expect(release.tag_name).toMatch(github.nightlyTagRegex);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('resolves nightly to a <version>-<sha>-nightly release for GoReleaser Pro', async () => {
|
it('resolves nightly to a <version>-<sha>-nightly release for GoReleaser Pro', async () => {
|
||||||
@@ -106,3 +104,16 @@ describe('getRelease', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('latestNightlyRelease', () => {
|
||||||
|
it('returns the newest nightly by published_at even when API order is wrong', () => {
|
||||||
|
const release = github.latestNightlyRelease([
|
||||||
|
{tag_name: 'v2.16.0-c9b458fa-nightly', published_at: '2026-05-12T01:27:50Z'},
|
||||||
|
{tag_name: 'v2.16.0-6724de64-nightly', published_at: '2026-05-13T01:32:53Z'},
|
||||||
|
{tag_name: 'v2.16.0-2827930b-nightly', published_at: '2026-05-17T01:34:11Z'},
|
||||||
|
{tag_name: 'v2.15.4', published_at: '2026-04-21T14:07:57Z'}
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(release?.tag_name).toEqual('v2.16.0-2827930b-nightly');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -104,18 +104,6 @@ describe('getCertificateIdentity', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses nightly-oss.yml@refs/heads/main for OSS legacy nightly tag', () => {
|
|
||||||
expect(goreleaser.getCertificateIdentity('goreleaser', 'nightly')).toEqual(
|
|
||||||
'https://github.com/goreleaser/goreleaser/.github/workflows/nightly-oss.yml@refs/heads/main'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('uses nightly-pro.yml@refs/heads/main for Pro legacy nightly tag', () => {
|
|
||||||
expect(goreleaser.getCertificateIdentity('goreleaser-pro', 'nightly')).toEqual(
|
|
||||||
'https://github.com/goreleaser/goreleaser-pro-internal/.github/workflows/nightly-pro.yml@refs/heads/main'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('uses nightly-oss.yml@refs/heads/main for OSS nightly tag', () => {
|
it('uses nightly-oss.yml@refs/heads/main for OSS nightly tag', () => {
|
||||||
expect(goreleaser.getCertificateIdentity('goreleaser', 'v2.16.0-abc1234-nightly')).toEqual(
|
expect(goreleaser.getCertificateIdentity('goreleaser', 'v2.16.0-abc1234-nightly')).toEqual(
|
||||||
'https://github.com/goreleaser/goreleaser/.github/workflows/nightly-oss.yml@refs/heads/main'
|
'https://github.com/goreleaser/goreleaser/.github/workflows/nightly-oss.yml@refs/heads/main'
|
||||||
|
|||||||
+8
-8
File diff suppressed because one or more lines are too long
Generated
+76
-20
@@ -7,12 +7,12 @@
|
|||||||
"name": "goreleaser-action",
|
"name": "goreleaser-action",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^3.0.0",
|
"@actions/core": "^3.0.1",
|
||||||
"@actions/exec": "^3.0.0",
|
"@actions/exec": "^3.0.0",
|
||||||
"@actions/http-client": "^4.0.0",
|
"@actions/http-client": "^4.0.1",
|
||||||
"@actions/tool-cache": "^4.0.0",
|
"@actions/tool-cache": "^4.0.0",
|
||||||
"js-yaml": "^4.1.1",
|
"js-yaml": "^5.2.0",
|
||||||
"semver": "^7.7.4",
|
"semver": "^7.8.5",
|
||||||
"yargs": "^18.0.0"
|
"yargs": "^18.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.1.tgz",
|
||||||
"integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==",
|
"integrity": "sha512-a6d/Nwahm9fliVGRhdhofo40HjHQasUPusmc7vBfyky+7Z+P2A1J68zyFVaNcEclc/Se+eO595oAr5nwEIoIUA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/exec": "^3.0.0",
|
"@actions/exec": "^3.0.0",
|
||||||
@@ -53,9 +53,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/http-client": {
|
"node_modules/@actions/http-client": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.1.tgz",
|
||||||
"integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
|
"integrity": "sha512-+Nvd1ImaOZBSoPbsUtEhv+1z99H12xzncCkz0a3RuehINE81FZSe2QTj3uvAPTcJX/SCzUQHQ0D1GrPMbrPitg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tunnel": "^0.0.6",
|
"tunnel": "^0.0.6",
|
||||||
@@ -685,6 +685,29 @@
|
|||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@eslint/eslintrc/node_modules/js-yaml": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/puzrin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nodeca"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"argparse": "^2.0.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"js-yaml": "bin/js-yaml.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@eslint/eslintrc/node_modules/minimatch": {
|
"node_modules/@eslint/eslintrc/node_modules/minimatch": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
@@ -2757,6 +2780,29 @@
|
|||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint/node_modules/js-yaml": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/puzrin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nodeca"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"argparse": "^2.0.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"js-yaml": "bin/js-yaml.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eslint/node_modules/minimatch": {
|
"node_modules/eslint/node_modules/minimatch": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
@@ -4217,15 +4263,25 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
"node_modules/js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.0.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-YeLUMlvR4Ou1B119LIaM0r65JvbOBooJDc9yEu0dClb/uSC5P4FrLU8OCCz/HXWvtPoIrR0dRzABTjo1sTN9Bw==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/puzrin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nodeca"
|
||||||
|
}
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"js-yaml": "bin/js-yaml.js"
|
"js-yaml": "bin/js-yaml.mjs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/jsesc": {
|
"node_modules/jsesc": {
|
||||||
@@ -5058,9 +5114,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "7.7.4",
|
"version": "7.8.5",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
|
||||||
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
|
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"bin": {
|
"bin": {
|
||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
@@ -5609,9 +5665,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "6.24.1",
|
"version": "6.27.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.24.1.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz",
|
||||||
"integrity": "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA==",
|
"integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17"
|
"node": ">=18.17"
|
||||||
|
|||||||
+4
-5
@@ -23,14 +23,13 @@
|
|||||||
],
|
],
|
||||||
"author": "CrazyMax",
|
"author": "CrazyMax",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^3.0.0",
|
"@actions/core": "^3.0.1",
|
||||||
"@actions/exec": "^3.0.0",
|
"@actions/exec": "^3.0.0",
|
||||||
"@actions/http-client": "^4.0.0",
|
"@actions/http-client": "^4.0.1",
|
||||||
"@actions/tool-cache": "^4.0.0",
|
"@actions/tool-cache": "^4.0.0",
|
||||||
"js-yaml": "^4.1.1",
|
"js-yaml": "^5.2.0",
|
||||||
"semver": "^7.7.4",
|
"semver": "^7.8.5",
|
||||||
"yargs": "^18.0.0"
|
"yargs": "^18.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+14
-10
@@ -28,13 +28,21 @@ const withRetry = async <T>(operation: () => Promise<T>): Promise<T> => {
|
|||||||
|
|
||||||
export interface GitHubRelease {
|
export interface GitHubRelease {
|
||||||
tag_name: string;
|
tag_name: string;
|
||||||
|
published_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches the new-style nightly release tag pattern: vX.Y.Z-<sha>-nightly
|
// Matches the new-style nightly release tag pattern: vX.Y.Z-<sha>-nightly
|
||||||
export const nightlyTagRegex = /^v\d+\.\d+\.\d+-[0-9a-f]+-nightly$/i;
|
export const nightlyTagRegex = /^v\d+\.\d+\.\d+-[0-9a-f]+-nightly$/i;
|
||||||
|
|
||||||
export const isNightlyTag = (tag: string): boolean => {
|
export const isNightlyTag = (tag: string): boolean => {
|
||||||
return tag === 'nightly' || nightlyTagRegex.test(tag);
|
return nightlyTagRegex.test(tag);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const latestNightlyRelease = (releases: Array<GitHubRelease>): GitHubRelease | undefined => {
|
||||||
|
return releases
|
||||||
|
.filter(r => nightlyTagRegex.test(r.tag_name))
|
||||||
|
.sort((a, b) => (b.published_at || '').localeCompare(a.published_at || ''))
|
||||||
|
.shift();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
|
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
|
||||||
@@ -113,16 +121,12 @@ const resolveNightly = async (distribution: string): Promise<GitHubRelease> => {
|
|||||||
return <Array<GitHubRelease>>JSON.parse(body);
|
return <Array<GitHubRelease>>JSON.parse(body);
|
||||||
});
|
});
|
||||||
|
|
||||||
const match = releases.find(r => nightlyTagRegex.test(r.tag_name));
|
const match = latestNightlyRelease(releases);
|
||||||
if (match) {
|
if (!match) {
|
||||||
core.info(`Resolved nightly to ${match.tag_name}`);
|
throw new Error(`No '<version>-<sha>-nightly' release found in ${url}`);
|
||||||
return match;
|
|
||||||
}
|
}
|
||||||
|
core.info(`Resolved nightly to ${match.tag_name}`);
|
||||||
// Fallback to the legacy moving `nightly` tag during the transition period,
|
return match;
|
||||||
// until goreleaser stops publishing it.
|
|
||||||
core.warning(`No '<version>-<sha>-nightly' release found in ${url}, falling back to 'nightly' tag`);
|
|
||||||
return {tag_name: 'nightly'};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import yaml from 'js-yaml';
|
import * as yaml from 'js-yaml';
|
||||||
import * as context from './context';
|
import * as context from './context';
|
||||||
import * as github from './github';
|
import * as github from './github';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
@@ -171,7 +171,7 @@ const getFilename = (distribution: string): string => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function getDistPath(yamlfile: string): Promise<string> {
|
export async function getDistPath(yamlfile: string): Promise<string> {
|
||||||
const cfg = yaml.load(fs.readFileSync(yamlfile, 'utf8'));
|
const cfg = yaml.load(fs.readFileSync(yamlfile, 'utf8')) as {dist?: string};
|
||||||
return cfg.dist || 'dist';
|
return cfg.dist || 'dist';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user