Skip to content

Commit

Permalink
Migrate publish GH action to the official pub.dev way of auth
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrintt committed Feb 16, 2024
1 parent d483635 commit 022abdf
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
name: Publish new plugin version
name: Publish new plugin version to pub.dev
run-name: >-
[shared_storage] package publish (${{ github.ref_name }}) triggered by @${{ github.actor }}
on:
workflow_dispatch:
push:
branches:
- release
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

# Publish using custom workflow
jobs:
publish:
permissions:
id-token: write # This is required for authentication using OIDC
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.7.7"
channel: "stable"
- run: |
flutter --version
flutter pub get
flutter analyze --fatal-infos
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1

- name: Install dependencies
run: dart pub get

- name: Create credentials file
run: echo $PUB_CREDENTIALS > ~/pub-credentials.json
env:
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }}
- name: Run Dart analyzer
run: dart analyze --fatal-infos

- name: Add credentials to Dart folder
run: |
mkdir -p ${XDG_CONFIG_HOME:-${HOME:-default}}/dart
touch ${XDG_CONFIG_HOME:-${HOME:-default}}/dart/pub-credentials.json
cp ~/pub-credentials.json ${XDG_CONFIG_HOME:-${HOME:-default}}/dart/pub-credentials.json
env:
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }}
- name: Run tests
run: dart test

- name: Publish
run: dart pub publish --force

0 comments on commit 022abdf

Please sign in to comment.