Fix CI ident - vscode doesnt like me #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.21" | |
| - name: Install dependencies | |
| run: go mod tidy | |
| - name: Run linter | |
| uses: golangci/golangci-lint-action@v3 | |
| with: | |
| version: v1.54 | |
| - name: Run tests | |
| run: | | |
| go test ./... -v -coverprofile=coverage.out | |
| go tool cover -func=coverage.out | |
| - name: Build | |
| run: make build | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./coverage.out | |
| fail_ci_if_error: true | |
| release: | |
| needs: build-and-test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.21" | |
| - name: Build binary | |
| run: | | |
| GOOS=linux GOARCH=amd64 go build -o envsync-linux-amd64 ./main.go | |
| GOOS=darwin GOARCH=amd64 go build -o envsync-darwin-amd64 ./main.go | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: envsync-binaries | |
| path: | | |
| envsync-linux-amd64 | |
| envsync-darwin-amd64 | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| envsync-linux-amd64 | |
| envsync-darwin-amd64 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |