From dad09270f42e1bfbad9ccfbfce80e58f96715a54 Mon Sep 17 00:00:00 2001 From: Max Leske Date: Sat, 18 May 2024 14:57:45 +0200 Subject: [PATCH] chore: release on tag push --- .github/workflows/publish.yml | 2 +- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++ .goreleaser.yml | 58 +++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ab35cf1..ef65951 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,7 +41,7 @@ jobs: - name: Build images id: build-and-push env: - GIT_TAG: "${GITHUB_REF}" + GIT_TAG: ${{ env.GITHUB_REF }} uses: docker/bake-action@v4.1.0 with: files: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5a3d340 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: goreleaser + +on: + push: + tags: + - '*' + +# Declare default permissions as read only. +permissions: read-all + +jobs: + goreleaser: + runs-on: ubuntu-latest + permissions: + # https://goreleaser.com/ci/actions/#token-permissions + contents: write + packages: write + + steps: + - + name: Checkout + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + with: + fetch-depth: 0 + - + name: Set up QEMU + uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + - + name: Set up Go + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + with: + go-version: ^1.22 + cache: true + - + name: Login to GitHub Container Registry + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0 + if: startsWith(github.ref, 'refs/tags/') + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..bb168f4 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,58 @@ +--- +# This is an example .goreleaser.yml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +project_name: ftw +before: + hooks: + # You may remove this if you don't use go modules. + - go mod download +builds: + - id: albedo + env: + - CGO_ENABLED=0 + binary: ftw + targets: + - linux_amd64 + - linux_arm64 + - darwin_amd64 + - darwin_arm64 + - windows_amd64 +archives: + - format_overrides: + - goos: windows + format: zip +checksum: + name_template: '{{ .ProjectName }}-checksums.txt' +snapshot: + name_template: '{{ .Tag }}-next' +changelog: + sort: asc + use: github + groups: + - title: Features + regexp: '^.*feat[(\\w)]*:+.*$' + order: 0 + - title: 'Bug fixes' + regexp: '^.*fix[(\\w)]*:+.*$' + order: 1 + - title: Others + order: 999 + filters: + exclude: + - '^docs' + - '^test' +release: + prerelease: auto +nfpms: + - id: 'ftw' + builds: ['ftw'] + formats: + - deb + - rpm + bindir: /usr/bin + file_name_template: '{{ .ConventionalFileName }}' + vendor: OWASP Core Rule Set Project + homepage: https://github.com/coreruleset/albedo + maintainer: cirques-tellers.0d@icloud.com + description: Albedo - HTTP reflector and black hole + license: APL2