xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

GitHub Actions & GitHub Secrets

GitHub Actions & GitHub Secrets

tokens & private variable

GitHub Secrets

https://github.com/xgqfrms/dart-library-package/settings/secrets

tokens

access token & refresh token

{
  "accessToken": "<YOUR_ACCESS_TOKEN>",
  "refreshToken": "<YOUR_REFRESH_TOKEN>",
  "tokenEndpoint": "https://accounts.google.com/o/oauth2/token",
  "scopes": [
    "openid",
    "https://www.googleapis.com/auth/userinfo.email"
  ],
  "expiration": 1583046238465
}

https://github.com/xgqfrms/dart-library-package/tree/pub

GitHub Actions

name: Publish Dart Package

on:
  push:
    branches: [ pub ]
  pull_request:
    branches: [ pub ]

jobs:
  build:

    runs-on: ubuntu-latest

    container:
      image: google/dart:latest

    steps:
    - uses: actions/checkout@v2
    - name: Install dependencies
      run: pub get
    # - name: Run tests
      # run: pub run test
    - name: pub publish 🎯
      run: pub publish

https://github.com/xgqfrms/dart-library-package/blob/pub/.github/workflows/publish-dart-package.yml

https://github.com/xgqfrms/dart-library-package/blob/master/.github/workflows/publish-dart-package.yml

https://github.com/xgqfrms/dart-library-package/actions

solution

dart

name: Publish Package

on:
  release: [published]

jobs:
  build:
    runs-on: ubuntu-latest

    container:
      image:  google/dart:latest

    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: pub get
      - name: Run tests
        run: pub run test
      - name: Setup Pub Credentials
        shell: bash
        env:
          PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }}
          PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }}
          PUB_DEV_PUBLISH_TOKEN_ENDPOINT: ${{ secrets.PUB_DEV_PUBLISH_TOKEN_ENDPOINT }}
          PUB_DEV_PUBLISH_EXPIRATION: ${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }}
        run: |
          sh ./pub_login.sh
      - name: Check Publish Warnings
        run: pub publish --dry-run
      - name: Publish Package
        run: pub publish -f

flutter

name: Publish Package

on:
  release: [published]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Install Flutter
        uses: subosito/flutter-action@v1
        with:
          flutter-version: '1.9.1+hotfix.6'
      - name: Install dependencies
        run: flutter pub get
      - name: Analyze
        run: flutter analyze
      - name: Run tests
        run: flutter test
      - name: Setup Pub Credentials
        shell: bash
        env:
          PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }}
          PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }}
          PUB_DEV_PUBLISH_TOKEN_ENDPOINT: ${{ secrets.PUB_DEV_PUBLISH_TOKEN_ENDPOINT }}
          PUB_DEV_PUBLISH_EXPIRATION: ${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }}
        run: |
          sh ./pub_login.sh
      - name: Check Publish Warnings
        run: pub publish --dry-run
      - name: Publish Package
        run: pub publish -f

refs

https://birjuvachhani.dev/posts/publish-your-flutter-package-using-github-actions/



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-09-08 12:39  xgqfrms  阅读(784)  评论(4编辑  收藏  举报