Skip to content

feat: fix pub.dev OAuth credentials path in publishing workflow (#79) #134

feat: fix pub.dev OAuth credentials path in publishing workflow (#79)

feat: fix pub.dev OAuth credentials path in publishing workflow (#79) #134

Workflow file for this run

name: Dart CI
on:
# Run on PRs and pushes to the master branch.
push:
branches: [master]
pull_request:
branches: [master]
env:
PUB_ENVIRONMENT: bot.github
jobs:
# Check code formatting and static analysis on Ubuntu.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [stable]
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
- name: Analyze code
run: dart analyze --fatal-infos
# runs dart test
test:
needs: analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
# release on Github and pub.dev
publish:
needs: test
if: github.repository == 'casbin/dart-casbin' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g "@semantic-release/changelog"
- run: npm install -g "@semantic-release/git"
- run: npm install -g "pub-semantic-release"
# Setup pub.dev credentials for automated publishing
# The credentials.json file should be stored as a repository secret
- name: Setup Pub Credentials
run: |
mkdir -p $HOME/.pub-cache
echo '${{ secrets.PUB_CREDENTIALS }}' > $HOME/.pub-cache/credentials.json
- name: Semantic Release
run: |
export NODE_PATH="$(npm root -g)"
npx semantic-release@17
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to pub.dev
run: dart pub publish --force