From 8a2e95e5250050fa32727e12ebe4e9cd3231c091 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 9 Jan 2024 08:42:22 -0300 Subject: [PATCH] ci: update build scripts --- .github/workflows/build.yml | 30 +++++++----------------------- .github/workflows/gen.yml | 16 +++++----------- .github/workflows/goreleaser.yml | 27 +++++++-------------------- .github/workflows/lint.yml | 14 +++++++------- 4 files changed, 26 insertions(+), 61 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b18f1a..e89733a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,28 +6,12 @@ on: jobs: build: - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - strategy: - matrix: - go-version: [~1.18] - os: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.os }} - env: - GO111MODULE: "on" + runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v2 + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 with: - go-version: ${{ matrix.go-version }} - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Download Go modules - run: go mod tidy - - - name: Build - run: go build -v ./... - - - name: Test - run: go test ./... + go-version: stable + - run: go mod tidy + - run: go build -v ./... + - run: go test ./... diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index b58b497..a555506 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -3,23 +3,17 @@ name: generate on: push: branches: - - 'master' + - "master" jobs: docs: runs-on: ubuntu-latest steps: - - - name: checkout - uses: actions/checkout@v2 - - - name: setup go - uses: actions/setup-go@v2 + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 with: - go-version: 1.18 - - - name: docs - run: ./scripts/docs.sh + go-version: stable + - run: ./scripts/docs.sh - uses: stefanzweifel/git-auto-commit-action@v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 8354ab4..bc26093 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -3,35 +3,26 @@ name: goreleaser on: push: tags: - - '*' + - "*" jobs: goreleaser: - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: - - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v2 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 + - uses: actions/setup-go@v2 with: - go-version: ~1.18 - - - name: Set up Snapcraft - run: | + go-version: stable + - run: | sudo apt-get update sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft mkdir -p $HOME/.cache/snapcraft/download mkdir -p $HOME/.cache/snapcraft/stage-packages snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_LOGIN }}") - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - if: success() && startsWith(github.ref, 'refs/tags/') + - uses: goreleaser/goreleaser-action@v2 + if: success() with: distribution: goreleaser-pro version: latest @@ -40,8 +31,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GH_PAT }} FURY_TOKEN: ${{ secrets.FURY_TOKEN }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} - TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} - TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} - TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} AUR_KEY: ${{ secrets.AUR_KEY }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7eaa461..35b1bc2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,20 +4,20 @@ on: push: pull_request: +permissions: + contents: read + jobs: golangci: name: lint - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: - go-version: ~1.18 - - - uses: actions/checkout@v2 + go-version: stable - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: # Use supplied Go version skip-go-installation: true