feat: support "-v/--version" to get version of casbin-go-cli #31
Workflow file for this run
This file contains 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: Build | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: ['1.19', '1.20', '1.21'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Run go test | |
run: make test | |
semantic-release: | |
needs: test | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release@v19.0.2 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
- name: Get Casbin version from go.mod | |
id: go-mod-version | |
run: | | |
version=$(go list -m -json github.com/casbin/casbin/v2 | jq -r .Version) | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: '~> v2' | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CASBIN_VERSION: ${{ steps.go-mod-version.outputs.version }} |