Skip to content

Commit 4ca94ac

Browse files
authored
Merge pull request #68 from maxmind/greg/stf-42-release-workflow-environment
Use release environment in release workflow
2 parents e1a7d4b + 7cde4e6 commit 4ca94ac

9 files changed

Lines changed: 351 additions & 272 deletions

File tree

.github/workflows/release.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,50 @@
11
name: Release
22

33
on:
4+
workflow_dispatch:
5+
pull_request:
46
push:
5-
tags:
6-
- 'v*'
7-
8-
permissions:
9-
contents: write
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
1012

1113
jobs:
14+
goreleaser-check:
15+
name: Check GoReleaser
16+
if: github.event_name != 'release'
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
23+
with:
24+
fetch-depth: 0
25+
submodules: recursive
26+
persist-credentials: false
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
30+
with:
31+
go-version: '1.25'
32+
cache: false
33+
34+
- name: Check GoReleaser
35+
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
36+
with:
37+
distribution: goreleaser
38+
version: latest
39+
args: release --snapshot --clean --skip=publish
40+
1241
goreleaser:
1342
name: Release with GoReleaser
43+
if: github.event_name == 'release' && github.event.action == 'published'
1444
runs-on: ubuntu-latest
45+
environment: release
46+
permissions:
47+
contents: write
1548
steps:
1649
- name: Checkout code
1750
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

.golangci.yml

Lines changed: 84 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ linters:
5353

5454
- gocognit
5555

56+
# Replaced by gomodguard_v2.
57+
- gomodguard
58+
5659
# We don't want to forbid TODO, FIXME, etc.
5760
- godox
5861

@@ -309,92 +312,90 @@ linters:
309312
toolchain-forbidden: true
310313
go-version-pattern: \d\.\d+(\.0)?
311314

312-
# IMPORTANT: gomodguard blocks _modules_, not arbitrary packages. Be
315+
# IMPORTANT: gomodguard_v2 blocks _modules_, not arbitrary packages. Be
313316
# sure to use the module path from the go.mod file for these.
314317
# See https://github.com/ryancurrah/gomodguard/issues/12
315-
gomodguard:
318+
gomodguard_v2:
316319
blocked:
317-
modules:
318-
- github.com/avct/uasurfer:
319-
recommendations:
320-
- github.com/xavivars/uasurfer
321-
reason: The original avct module appears abandoned.
322-
- github.com/BurntSushi/toml:
323-
recommendations:
324-
- github.com/pelletier/go-toml/v2
325-
reason: This library panics frequently on invalid input.
326-
- github.com/pelletier/go-toml:
327-
recommendations:
328-
- github.com/pelletier/go-toml/v2
329-
reason: This is an outdated version.
330-
- github.com/gofrs/uuid:
331-
recommendations:
332-
- github.com/google/uuid
333-
- github.com/gofrs/uuid/v5:
334-
recommendations:
335-
- github.com/google/uuid
336-
- github.com/satori/go.uuid:
337-
recommendations:
338-
- github.com/google/uuid
339-
- github.com/google/uuid:
340-
recommendations:
341-
- github.com/google/uuid
342-
- github.com/lib/pq:
343-
recommendations:
344-
- github.com/jackc/pgx
345-
reason: This library is no longer actively maintained.
346-
- github.com/neilotoole/errgroup:
347-
recommendations:
348-
- golang.org/x/sync/errgroup
349-
reason: This library can lead to subtle deadlocks in certain use cases.
350-
- github.com/pariz/gountries:
351-
reason: This library's data is not actively maintained. Use GeoInfo data.
352-
github.com/pkg/errors:
353-
recommendations:
354-
- errors
355-
reason: pkg/errors is no longer maintained.
356-
- github.com/RackSec/srslog:
357-
recommendations:
358-
- log/syslog
359-
reason: This library's data is not actively maintained.
360-
- github.com/ua-parser/uap-go:
361-
recommendations:
362-
- github.com/xavivars/uasurfer
363-
reason: The performance of this library is absolutely abysmal.
364-
- github.com/ugorji/go:
365-
recommendations:
366-
- encoding/json
367-
- github.com/mailru/easyjson
368-
reason: This library is poorly maintained. We should default to using encoding/json and use easyjson where performance really matters.
369-
- github.com/zeebo/assert:
370-
recommendations:
371-
- github.com/stretchr/testify/assert
372-
reason: Use github.com/stretchr/testify/assert
373-
- gopkg.in/yaml.v2:
374-
recommendations:
375-
- github.com/goccy/go-yaml
376-
reason: Not actively maintained.
377-
- gopkg.in/yaml.v3:
378-
recommendations:
379-
- github.com/goccy/go-yaml
380-
reason: Not actively maintained.
381-
- gotest.tools/v3:
382-
recommendations:
383-
- github.com/stretchr/testify/assert
384-
reason: Use github.com/stretchr/testify/assert
385-
- inet.af/netaddr:
386-
recommendations:
387-
- net/netip
388-
- go4.org/netipx
389-
reason: inet.af/netaddr has been deprecated.
390-
versions:
391-
- github.com/jackc/pgconn:
392-
reason: Use github.com/jackc/pgx/v5
393-
- github.com/jackc/pgtype:
394-
reason: Use github.com/jackc/pgx/v5
395-
- github.com/jackc/pgx:
396-
version: < 5.0.0
397-
reason: Use github.com/jackc/pgx/v5
320+
- module: github.com/avct/uasurfer
321+
recommendations:
322+
- github.com/xavivars/uasurfer
323+
reason: The original avct module appears abandoned.
324+
- module: github.com/BurntSushi/toml
325+
recommendations:
326+
- github.com/pelletier/go-toml/v2
327+
reason: This library panics frequently on invalid input.
328+
- module: github.com/pelletier/go-toml
329+
recommendations:
330+
- github.com/pelletier/go-toml/v2
331+
reason: This is an outdated version.
332+
- module: github.com/gofrs/uuid
333+
recommendations:
334+
- github.com/google/uuid
335+
- module: github.com/gofrs/uuid/v5
336+
recommendations:
337+
- github.com/google/uuid
338+
- module: github.com/satori/go.uuid
339+
recommendations:
340+
- github.com/google/uuid
341+
- module: github.com/google/uuid
342+
recommendations:
343+
- github.com/google/uuid
344+
- module: github.com/lib/pq
345+
recommendations:
346+
- github.com/jackc/pgx
347+
reason: This library is no longer actively maintained.
348+
- module: github.com/neilotoole/errgroup
349+
recommendations:
350+
- golang.org/x/sync/errgroup
351+
reason: This library can lead to subtle deadlocks in certain use cases.
352+
- module: github.com/pariz/gountries
353+
reason: This library's data is not actively maintained. Use GeoInfo data.
354+
- module: github.com/pkg/errors
355+
recommendations:
356+
- errors
357+
reason: pkg/errors is no longer maintained.
358+
- module: github.com/RackSec/srslog
359+
recommendations:
360+
- log/syslog
361+
reason: This library's data is not actively maintained.
362+
- module: github.com/ua-parser/uap-go
363+
recommendations:
364+
- github.com/xavivars/uasurfer
365+
reason: The performance of this library is absolutely abysmal.
366+
- module: github.com/ugorji/go
367+
recommendations:
368+
- encoding/json
369+
- github.com/mailru/easyjson
370+
reason: This library is poorly maintained. We should default to using encoding/json and use easyjson where performance really matters.
371+
- module: github.com/zeebo/assert
372+
recommendations:
373+
- github.com/stretchr/testify/assert
374+
reason: Use github.com/stretchr/testify/assert
375+
- module: gopkg.in/yaml.v2
376+
recommendations:
377+
- github.com/goccy/go-yaml
378+
reason: Not actively maintained.
379+
- module: gopkg.in/yaml.v3
380+
recommendations:
381+
- github.com/goccy/go-yaml
382+
reason: Not actively maintained.
383+
- module: gotest.tools/v3
384+
recommendations:
385+
- github.com/stretchr/testify/assert
386+
reason: Use github.com/stretchr/testify/assert
387+
- module: inet.af/netaddr
388+
recommendations:
389+
- net/netip
390+
- go4.org/netipx
391+
reason: inet.af/netaddr has been deprecated.
392+
- module: github.com/jackc/pgconn
393+
reason: Use github.com/jackc/pgx/v5
394+
- module: github.com/jackc/pgtype
395+
reason: Use github.com/jackc/pgx/v5
396+
- module: github.com/jackc/pgx
397+
version: < 5.0.0
398+
reason: Use github.com/jackc/pgx/v5
398399

399400
gosec:
400401
excludes:

0 commit comments

Comments
 (0)