Skip to content

Commit

Permalink
ci: added goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
rlardy-ulule committed Aug 30, 2023
1 parent 77b4f0c commit 44a6e10
Showing 1 changed file with 22 additions and 60 deletions.
82 changes: 22 additions & 60 deletions .github/workflows/mover.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,33 @@
name: Mover
name: goreleaser

on:
push:
# branches: [ main ]
pull_request:
branches: [ main ]
# run only against tags
tags:
- '*'

jobs:

linter:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
GO_VERSION: 1.15
GOLINT_VERSION: 1.51.2

steps:
- name: Checking out repository
uses: actions/checkout@v3

- name: Setting up Go environment
uses: actions/setup-go@v3
with:
go-version: '^${{ env.GO_VERSION }}'
cache: true
cache-dependency-path: go.sum

- name: Download gomod dependencies
run: go mod download -x
permissions:
contents: write
# packages: write
# issues: write

- name: Run linters
uses: golangci/golangci-lint-action@v3
with:
version: v${{ env.GOLINT_VERSION }}
args: -v -c .golangci.yml --timeout 10m
# skip-cache: true
# skip-pkg-cache: true
# skip-build-cache: true

build:
timeout-minutes: 30
jobs:
goreleaser:
runs-on: ubuntu-latest

steps:
- name: Checking out repository
uses: actions/checkout@v3

- name: Login to GCR
uses: docker/login-action@v2
- uses: actions/checkout@v3
with:
registry: ${{ vars.REGISTRY }}
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}

- name: Login to Docker Hub
uses: docker/login-action@v2
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
username: ulule
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
go-version: stable

- name: Build app and push
uses: docker/build-push-action@v4
- uses: goreleaser/goreleaser-action@v4
with:
push: true
tags: ${{ vars.REGISTRY }}/mover:${{ github.sha }},${{ vars.REGISTRY }}/mover:latest
cache-from: type=registry,ref=${{ vars.REGISTRY }}/mover:cache
cache-to: type=registry,ref=${{ vars.REGISTRY }}/mover:cache,mode=max
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 44a6e10

Please sign in to comment.