Skip to content

Commit

Permalink
ci: update GoReleaser config (#787)
Browse files Browse the repository at this point in the history
* ci: update GoReleaser config

* fix linter

* wip

* fix

* clean

* fix

* fix again
  • Loading branch information
dunglas committed Jul 18, 2023
1 parent e079049 commit 0e305ff
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 157 deletions.
26 changes: 12 additions & 14 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"threshold": 0,
"reporters": [
"consoleFull"
],
"ignore": [
"**/__snapshots__/**",
"**/*_test.go",
"**/examples",
"**/node_modules",
"**/dist"
],
"absolute": true
}

"threshold": 0,
"reporters": ["consoleFull"],
"ignore": [
"**/__snapshots__/**",
"**/*_test.go",
"**/examples",
"**/node_modules",
"**/dist",
"**/.goreleaser.yml"
],
"absolute": true
}
49 changes: 39 additions & 10 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
push:
tags:
- 'v*'
branches:
- '*'
pull_request:

permissions:
contents: write

jobs:
release:
Expand All @@ -13,28 +19,51 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Docker Hub Login
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
-
name: Import GPG key
cache-dependency-path: |
go.sum
caddy/go.sum
- name: Login to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser

- name: Set GoReleaser Git tags
run: |
tags=$(git tag --list --sort=-version:refname 'v*')
echo "GORELEASER_CURRENT_TAG=$(awk 'NR==1 {print;exit}' <<< "$tags")" >> "$GITHUB_ENV"
echo "GORELEASER_PREVIOUS_TAG=$(awk 'NR==2 {print;exit}' <<< "$tags")" >> "$GITHUB_ENV"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
args: release --clean ${{startsWith(github.ref, 'refs/tags/v') && '' || '--snapshot'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

- name: Display version
run: dist/caddy_linux_amd64_v1/mercure version

- name: Upload snapshot
if: ${{!startsWith(github.ref, 'refs/tags/v')}}
uses: actions/upload-artifact@v3
with:
name: snapshot
path: dist/*
retention-days: 1
4 changes: 2 additions & 2 deletions .github/workflows/ci-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: '3.10'

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
uses: helm/chart-testing-action@v2

- name: Run chart-testing (list-changed)
id: list-changed
Expand All @@ -39,7 +39,7 @@ jobs:

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.5.0
uses: helm/kind-action@v1

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
Expand Down
Loading

0 comments on commit 0e305ff

Please sign in to comment.