diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3d55e2..32b0548 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,35 +1,51 @@ -name: Release +name: '🧑‍🏭' -on: - push: - tags: - - "*" +on: [ push, pull_request ] jobs: - build: - runs-on: ubuntu-latest + check: + runs-on: ubuntu-22.04 steps: + - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true + + - name: Run linter and tests + run: go test -v -vet='all' ./... + + release: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') == true + needs: check + runs-on: ubuntu-22.04 + steps: + + - name: Checkout + uses: actions/checkout@v4 with: - go-version: 1.20.x + fetch-depth: 0 - - name: Install dependencies - run: go get . + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true - name: Build windows/amd64 run: GOOS=windows GOARCH=amd64 go build -o ChunkCleaner-Win64.exe - name: Build linux/amd64 - run: GOOS=linux GOARCH=amd64 go build -o ChunkCleaner-Linux64 -v ./... - - - name: Debug - List files - run: | - ls ${{ github.workspace }} + run: GOOS=linux GOARCH=amd64 go build -o ChunkCleaner-Linux64 - name: Release uses: marvinpinto/action-automatic-releases@latest diff --git a/.gitignore b/.gitignore index 12feb64..2050d80 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# +/ChunkCleaner-Linux64 +/ChunkCleaner-Win64.exe + # Binaries for programs and plugins *.exe *.exe~ @@ -22,4 +22,4 @@ go.work # User-specific stuff .idea/ -*.iml \ No newline at end of file +*.iml