From d945cac7f7218ef931687c857ed99d93be0b0918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=BC=C3=9F?= Date: Tue, 22 Jun 2021 17:01:01 +0200 Subject: [PATCH] feat: goreleaser --- .github/workflows/build-container.yml | 42 ----------------------- .github/workflows/{lint.yml => build.yml} | 14 +++++--- .github/workflows/misspell.yml | 21 ------------ .github/workflows/release.yml | 33 ++++++++++++++++++ .gitignore | 1 + 5 files changed, 43 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/build-container.yml rename .github/workflows/{lint.yml => build.yml} (64%) delete mode 100644 .github/workflows/misspell.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml deleted file mode 100644 index 08c49ab..0000000 --- a/.github/workflows/build-container.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: build-container - -on: - push: - branches: ['master'] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v3 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker image - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/lint.yml b/.github/workflows/build.yml similarity index 64% rename from .github/workflows/lint.yml rename to .github/workflows/build.yml index 53b051e..509c6c9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/build.yml @@ -2,13 +2,17 @@ name: golangci-lint on: push: - tags: - - v* - branches: - - master - - main pull_request: jobs: + test: + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: ~1.16 + - uses: actions/checkout@v2 + - run: go test ./... golangci: name: lint runs-on: ubuntu-latest diff --git a/.github/workflows/misspell.yml b/.github/workflows/misspell.yml deleted file mode 100644 index fa4db54..0000000 --- a/.github/workflows/misspell.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: misspell -on: - push: - tags: - - v* - branches: - - master - - main - pull_request: -jobs: - misspell: - name: spellcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: misspell - uses: reviewdog/action-misspell@v1 - with: - github_token: ${{ secrets.github_token }} - locale: 'US' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f702d7a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: release + +on: + push: + branches: + - 'master' + tags: + - 'v*' + +permissions: + contents: write + packages: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 3366635..73ab1a9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ tmp/ +dist/ distrust.yml