Skip to content

Commit c622095

Browse files
committed
feat: switch to snapshot versions for commits, manual releases for official versions (#1654)
1 parent b190fce commit c622095

3 files changed

Lines changed: 57 additions & 19 deletions

File tree

.github/workflows/default.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,3 @@ jobs:
3838

3939
- name: Run go test bench
4040
run: make benchmark
41-
42-
semantic-release:
43-
needs: test
44-
runs-on: ubuntu-latest
45-
steps:
46-
- name: Checkout
47-
uses: actions/checkout@v3
48-
with:
49-
fetch-depth: 0
50-
- name: Setup Node.js
51-
uses: actions/setup-node@v3
52-
with:
53-
node-version: 20
54-
55-
- name: Run semantic-release
56-
if: github.repository == 'casbin/casbin' && github.event_name == 'push'
57-
run: make release
58-
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Release type (major, minor, patch)'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- major
13+
- minor
14+
- patch
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: 20
32+
33+
- name: Setup Git
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "github-actions[bot]@users.noreply.github.com"
37+
38+
- name: Run semantic-release
39+
run: npx semantic-release@v19.0.2
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@ Good pull requests (e.g. patches, improvements, new features) are a fantastic he
3333
Please ask first before embarking on any significant pull request (e.g. implementing new features, refactoring code etc.), otherwise you risk spending a lot of time working on something that the maintainers might not want to merge into the project.
3434

3535
First add an issue to the project to discuss the improvement. Please adhere to the coding conventions used throughout the project. If in doubt, consult the [Effective Go style guide](https://golang.org/doc/effective_go.html).
36+
37+
## Releases
38+
39+
This project uses snapshot versions for development commits. When you merge changes to the master branch, they become available as pseudo-versions that can be referenced using commit hashes.
40+
41+
For users who want to use the latest development version:
42+
```bash
43+
go get github.com/casbin/casbin/v3@master
44+
```
45+
46+
For users who want to use a specific commit:
47+
```bash
48+
go get github.com/casbin/casbin/v3@<commit-hash>
49+
```
50+
51+
Official releases are created manually by maintainers through the [Release workflow](https://github.com/casbin/casbin/actions/workflows/release.yml) in GitHub Actions. This ensures that only stable, well-tested versions receive official version tags.

0 commit comments

Comments
 (0)