feat: fix duplicate CI workflow runs on pull requests #36
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: Go | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| go: ["1.19","1.20","1.21"] | |
| runs-on: ubuntu-latest | |
| services: | |
| casbin: | |
| image: quay.io/coreos/etcd | |
| ports: | |
| - 2379:2379 | |
| - 2380:2380 | |
| env: | |
| ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379 | |
| ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 | |
| steps: | |
| - name: Set up Go | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - uses: actions/checkout@v2 | |
| - name: Run Unit tests | |
| run: go test -v -coverprofile=profile.cov ./... | |
| - name: Install goveralls | |
| env: | |
| GO111MODULE: off | |
| run: go get github.com/mattn/goveralls | |
| - name: Send coverage | |
| env: | |
| COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: goveralls -coverprofile=profile.cov -service=github | |
| semantic-release: | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Run semantic-release | |
| if: github.repository == 'casbin/etcd-watcher' && github.event_name == 'push' | |
| run: | | |
| npm install --save-dev semantic-release@17.2.4 | |
| npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |