feat: fix CI: configure semantic-release for Go repository (#12) #9
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 | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23.0' | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run tests | |
| run: go test -covermode=atomic -coverprofile=covprofile ./... | |
| - name: Install goveralls | |
| run: go install github.com/mattn/goveralls@latest | |
| - name: Send coverage | |
| env: | |
| COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: goveralls -coverprofile=covprofile -service=github | |
| semantic-release: | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Run semantic-release | |
| if: github.repository == 'casbin/okta-role-manager' && github.event_name == 'push' | |
| run: | | |
| npm install --save-dev semantic-release@17.2.4 | |
| npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |