Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Update publish action #652

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish Flutter package to pub.dev
description: Publish your Flutter package to pub.dev

inputs:
working-directory:
description: A directory with package to publish
required: true

runs:
using: "composite"
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.22.3

- 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: bash
run: flutter pub pub token add https://pub.dev --env-var PUB_TOKEN

- name: Install dependencies
shell: bash
run: flutter pub get
working-directory: ${{ inputs.working-directory }}

- name: Dry Run
shell: bash
run: flutter pub publish --dry-run
working-directory: ${{ inputs.working-directory }}

- name: Publish
shell: bash
run: flutter pub publish -f
working-directory: ${{ inputs.working-directory }}
16 changes: 2 additions & 14 deletions .github/workflows/mews_pedantic-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,12 @@ jobs:
name: Publish to pub.dev
runs-on: ubuntu-latest
environment: pub.dev

permissions:
id-token: write

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install Flutter
uses: subosito/flutter-action@v2
- uses: ./.github/actions/publish
with:
flutter-version: 3.22.2

- name: Install dependencies
run: flutter pub get

- name: Publish Dry Run
run: flutter pub publish --directory=mews_pedantic --dry-run

- name: Publish to pub.dev
run: flutter pub publish --directory=mews_pedantic --force
working-directory: mews_pedantic
15 changes: 2 additions & 13 deletions .github/workflows/optimus-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,10 @@ jobs:
environment: pub.dev
permissions:
id-token: write

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install Flutter
uses: subosito/flutter-action@v2
- uses: ./.github/actions/publish
with:
flutter-version: 3.22.2

- name: Install dependencies
run: flutter pub get

- name: Publish Dry Run
run: flutter pub publish --directory=optimus --dry-run

- name: Publish to pub.dev
run: flutter pub publish --directory=optimus --force
working-directory: optimus
Loading