From b34806f8f4356ae40bb7252d94e8d2982c43b8e8 Mon Sep 17 00:00:00 2001 From: Russ Garrett Date: Wed, 13 Mar 2024 10:44:35 +0000 Subject: [PATCH] Updated release action --- .github/workflows/build.yml | 32 +++++++++++++++----------------- .gitignore | 2 ++ .goreleaser.yaml | 24 ++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f789bf3..ea2f69d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,11 @@ jobs: runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -28,30 +30,26 @@ jobs: tags: | type=semver,pattern={{version}} type=sha - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v5 with: - go-version: "^1.17.3" + go-version: stable - name: Check Formatting run: gofmt -d -e . - name: Tests run: go test -v ./... - - name: Build - run: | - go get github.com/mitchellh/gox - gox -ldflags="-X main.branch=${{github.ref_name}} -X main.revision=${{github.sha}}" -osarch="linux/amd64 linux/arm darwin/amd64" -output="dist/{{.OS}}_{{.Arch}}_{{.Dir}}" + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Dockerfile id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: file: ./Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - files: | - dist/linux_amd64_irccat - dist/linux_arm_irccat - dist/darwin_amd64_irccat diff --git a/.gitignore b/.gitignore index f164b68..5a4a8fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ irccat irccat.json + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..119ae48 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 1 + +before: + hooks: + - go mod tidy + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + ldflags: + - -X main.branch={{.Version}} -X main.revision={{.Commit}} + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:"