diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f84f0199..22e6a426 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,25 +10,50 @@ permissions: jobs: linter: name: golangci-lint - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 50 - uses: actions/setup-go@v5 with: go-version-file: "go.mod" check-latest: true - name: Get golangci-lint configuration file - run: wget --output-document=/tmp/golangci.yml https://sc-devtools.s3.eu-west-1.amazonaws.com/golang-ci/golangci.yml - - uses: golangci/golangci-lint-action@v4 + run: wget --output-document=$(pwd)/.golangci.yml https://sc-devtools.s3.eu-west-1.amazonaws.com/golang-ci/golangci.yml + - name: "Execute golangci-lint on the master branch" + uses: golangci/golangci-lint-action@v4 + if: github.ref == 'refs/heads/master' + with: + # This flag is not working (https://github.com/golangci/golangci-lint-action/issues/531). + # We rather decided to use the suggestion from the FAQ (https://golangci-lint.run/usage/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues) and use `--new` and `--new-from-rev` + # only-new-issues: false + # args: "--config=/tmp/golangci.yml" + args: "--config=$(pwd)/.golangci.yml --new --new-from-rev=HEAD" + - name: Get master branch commit ID + if: github.ref != 'refs/heads/master' + id: new-from-rev + run: echo "NEW_FROM_REV=$( git show-branch --merge-base FETCH_HEAD )" >> "$GITHUB_OUTPUT" + - name: Display the commit ID + if: github.ref != 'refs/heads/master' + env: + NEW_FROM_REV: ${{ steps.new-from-rev.outputs.NEW_FROM_REV }} + run: echo "Master branch commit ID $NEW_FROM_REV" + - name: "Execute golangci-lint on a pull request" + uses: golangci/golangci-lint-action@v4 + if: github.ref != 'refs/heads/master' + env: + NEW_FROM_REV: ${{ steps.new-from-rev.outputs.NEW_FROM_REV }} with: # This flag is not working (https://github.com/golangci/golangci-lint-action/issues/531). # We rather decided to use the suggestion from the FAQ (https://golangci-lint.run/usage/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues) and use `--new` and `--new-from-rev` # only-new-issues: false - args: "--config=/tmp/golangci.yml --new --new-from-rev=HEAD~1" + # args: "--config=/tmp/golangci.yml" + args: "--config=$(pwd)/.golangci.yml --new-from-rev=${{ steps.new-from-rev.outputs.NEW_FROM_REV }}" tests: name: Unit Tests - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -42,7 +67,7 @@ jobs: needs: [linter, tests] name: GoReleaser Build on All OS but Windows if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 with: diff --git a/cmd/domains.go b/cmd/domains.go index fb727b96..1a7d9ae5 100644 --- a/cmd/domains.go +++ b/cmd/domains.go @@ -68,7 +68,7 @@ var ( if key == "domain.key" { key = "" } - err = domains.Add(c.Context, currentApp, c.Args().First(), cert, key) + domains.Add(c.Context, currentApp, c.Args().First(), cert, key) } else { cli.ShowCommandHelp(c, "domains-add") }