diff --git a/.github/workflows/push.yml b/.github/workflows/go-mod-tidy.yml similarity index 91% rename from .github/workflows/push.yml rename to .github/workflows/go-mod-tidy.yml index 3a1629c..803e9d9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/go-mod-tidy.yml @@ -1,6 +1,7 @@ -name: Push +name: go mod tidy -on: [push] +on: + push: jobs: mod-tidy: @@ -17,13 +18,13 @@ jobs: with: go-version: 1.17 - - name: Tidy + - name: Mod Tidy run: go mod tidy - name: Commit run: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - git add -A + git add . git diff-index --quiet HEAD || git commit -m "go mod tidy" - name: Push changes diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 74b3814..f11b3ab 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,8 @@ -name: Lint +name: go lint -on: [pull_request, push] +on: + pull_request: + push: jobs: golangci: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml deleted file mode 100644 index 2da6d1d..0000000 --- a/.github/workflows/pull_request.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Pull Request - -on: [pull_request] - -jobs: - pull: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - distribution: goreleaser - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - with: - path: dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a3940ed..4b866e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ name: Release on: push: branches: [ main ] + pull_request: permissions: contents: write @@ -22,14 +23,13 @@ jobs: go-version: 1.17 - name: Semantic Release + if: github.event_name != 'pull_request' uses: go-semantic-release/action@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: '0' + - name: Remove Local Changes + run: git stash -u - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 @@ -39,3 +39,8 @@ jobs: args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + path: dist