Skip to content

Publish to Pub.dev 🚀 #11

Publish to Pub.dev 🚀

Publish to Pub.dev 🚀 #11

name: Publish to Pub.dev 🚀
on:
workflow_dispatch:
inputs:
release_branch:
description: The branch to be released
type: string
required: true
default: 'main'
jobs:
publishing:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
ref: ${{ inputs.release_branch }}
- name: Get tags
run: git fetch --tags origin
- name: Check Versions 🔎
run: |
set -eo pipefail
export LIB_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "LIB_VERSION: ${LIB_VERSION}"
export PUBSPEC_VERSION=$(grep 'version: ' pubspec.yaml | sed -e 's,.*: \(.*\),\1,')
echo "PUBSPEC_VERSION: ${PUBSPEC_VERSION}"
if [ "$LIB_VERSION" != "${PUBSPEC_VERSION}" ]; then
echo "Version in 'pubspec.yaml' does not match tag.";
exit 1;
fi
- name: Publish Dart Package 🚢
id: publish
uses: k-paxian/[email protected]
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}