提交 aaf1bb95 authored 作者: JarvanMo's avatar JarvanMo

add automated publishing

上级 32bbf9e0
name: Publish Flutter package to pub.dev
description: Publish your Flutter package to pub.dev
inputs:
working-directory:
description: directory with-in the repository where the package is located (if not in the repository root)
required: false
runs:
using: "composite"
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
- name: 🪪 Get Id Token
uses: actions/github-script@v6
with:
script: |
let pub_token = await core.getIDToken('https://pub.dev')
core.exportVariable('PUB_TOKEN', pub_token)
- name: 📢 Authenticate
shell: ${{ inputs.shell }}
run: flutter pub pub token add https://pub.dev --env-var PUB_TOKEN
- name: 📦 Install dependencies
shell: ${{ inputs.shell }}
run: flutter pub get
working-directory: ${{ inputs.working-directory }}
- name: 🌵 Dry Run
shell: ${{ inputs.shell }}
run: flutter pub publish --dry-run
working-directory: ${{ inputs.working-directory }}
- name: 📢 Publish
shell: ${{ inputs.shell }}
run: flutter pub publish -f
working-directory: ${{ inputs.working-directory }}
\ No newline at end of file
...@@ -7,13 +7,13 @@ on: ...@@ -7,13 +7,13 @@ on:
jobs: jobs:
publish: publish:
environment: 'pub.dev'
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repo - name: 📚 Git Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Publish
uses: k-paxian/dart-package-publisher@master
with: with:
credentialJson: ${{ secrets.CREDENTIAL_JSON }} submodules: recursive
flutter: true - uses: ./.github/actions/publish_flutter_package
skipTests: true \ No newline at end of file
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论