-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.23 KB
/
publish.yml
File metadata and controls
53 lines (43 loc) · 1.23 KB
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
45
46
47
48
49
50
51
52
53
name: Publish
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: 3.9.0
- name: Install dependencies
run: dart pub get
- name: Verify tag matches pubspec version
if: startsWith(github.ref, 'refs/tags/')
run: |
set -euo pipefail
VERSION=$(grep -E '^version:' pubspec.yaml | awk '{print $2}')
TAG="${GITHUB_REF_NAME}"
if [ "${TAG}" != "v${VERSION}" ]; then
echo "Tag (${TAG}) does not match pubspec.yaml version (v${VERSION})."
exit 1
fi
- name: Configure pub.dev credentials
env:
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }}
run: |
set -euo pipefail
test -n "$PUB_CREDENTIALS"
mkdir -p "$HOME/.config/dart"
printf '%s' "$PUB_CREDENTIALS" > "$HOME/.config/dart/pub-credentials.json"
- name: Publish
run: dart pub publish --force