Skip to content

Commit e5692df

Browse files
authored
feat: updated workflow to automate github and pub.dev release (#47)
* feat: updated workflow to automate github and pub.dev release Signed-off-by: Mohit Kumar Singh <[email protected]> * feat: added configuration file for semantic-release Signed-off-by: Mohit Kumar Singh <[email protected]> * feat: updated config file Signed-off-by: Mohit Kumar Singh <[email protected]>
1 parent eee526a commit e5692df

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

.github/workflows/dart.yml

+33-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
jobs:
1414
# Check code formatting and static analysis on Ubuntu.
1515
analyze:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-20.04
1717
strategy:
1818
fail-fast: false
1919
matrix:
@@ -42,3 +42,35 @@ jobs:
4242
run: dart pub get
4343
- name: Run VM tests
4444
run: dart test --platform vm
45+
46+
# release on Github and pub.dev
47+
publish:
48+
needs: test
49+
if: github.repository == 'casbin/dart-casbin' && github.event_name == 'push'
50+
runs-on: ubuntu-20.04
51+
steps:
52+
- uses: actions/checkout@v2
53+
- uses: cedx/setup-dart@v2
54+
- uses: actions/setup-node@v2
55+
with:
56+
node-version: 14
57+
- run: npm install -g "@semantic-release/changelog"
58+
- run: npm install -g "@semantic-release/git"
59+
- run: npm install -g "pub-semantic-release"
60+
61+
- name: Semantic Release
62+
run: |
63+
export NODE_PATH="$(npm root -g)"
64+
npx semantic-release@17
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Publish to pub
69+
run: dart pub publish --dry-run
70+
71+
- uses: sakebook/[email protected]
72+
with:
73+
package_directory: ${{ matrix.package }}
74+
credential: ${{ secrets.PUB_CREDENTIALS }}
75+
flutter_package: true
76+
skip_test: true

.releaserc.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"debug": true,
3+
"branches": [
4+
"master"
5+
],
6+
"plugins": [
7+
"@semantic-release/commit-analyzer",
8+
"@semantic-release/release-notes-generator",
9+
"pub-semantic-release",
10+
[
11+
"@semantic-release/changelog",
12+
{
13+
"changelogFile": "CHANGELOG.md"
14+
}
15+
],
16+
[
17+
"@semantic-release/git",
18+
{
19+
"assets": ["pubspec.yaml", "CHANGELOG.md"],
20+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
21+
}
22+
],
23+
"@semantic-release/github"
24+
]
25+
}

0 commit comments

Comments
 (0)