-
Notifications
You must be signed in to change notification settings - Fork 5
44 lines (42 loc) · 1.36 KB
/
pubdev-publishing.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Publish to Pub.dev 🚀
on:
workflow_dispatch:
inputs:
release_branch:
description: The branch to be released
type: string
required: true
default: 'main'
force_publish:
description: Whether to force the publishing
type: boolean
required: true
default: false
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 }}
force: ${{ inputs.force_publish }}