-
Notifications
You must be signed in to change notification settings - Fork 388
83 lines (80 loc) · 2.81 KB
/
release.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release to Github release/pub.dev and tag 🚀
on:
pull_request:
types:
- closed
jobs:
release_if_merged:
if: ${{ github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == 'main' &&
contains(github.event.pull_request.labels.*.name, 'ci:prepare_release') }}
outputs:
release_version: ${{steps.release.outputs.version}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
- name: Install release-it
run: |
npm install -g release-it
npm install -g release-it/bumper
npm install -g release-it/conventional-changelog
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Release
id: release
run: |
PUBSPEC_VERSION=$(grep 'version: ' pubspec.yaml | sed -e 's,.*: \(.*\),\1,')
echo "pubspec version: ${PUBSPEC_VERSION}"
release-it ${PUBSPEC_VERSION} \
--no-git.commit \
--'git.commitMessage="chore: release ${version}"' \
--git.tag \
--'git.tagName="${version}"' \
--'git.tagAnnotation="Release ${version}"' \
--git.push \
--github.release \
--no-github.web \
--ci
echo "::set-output name=version::${PUBSPEC_VERSION}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Dart Package 🚢
id: publish
uses: k-paxian/dart-package-publisher@master
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
force: true # We have checked the `dart pub publish --dry-run` `in build.yaml`, it's ok to force publish here.
skipTests: true
attach_docs:
name: Attach dartdoc
runs-on: ubuntu-latest
needs: release_if_merged
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Build DartDoc 📖
run: |
dart pub get
# Generate DartDoc
dart doc
# Create a zip file of the DartDoc output
zip -r agora_rtc_engine_docs.zip doc
- name: Upload DartDoc Artifact ⬆️
uses: actions/upload-artifact@v3
with:
name: agora_rtc_engine_docs.zip
path: agora_rtc_engine_docs.zip
- name: Upload DartDoc Archive to GitHub release ⬆️
uses: svenstaro/upload-release-action@2.6.0
with:
file: agora_rtc_engine_docs.zip
asset_name: agora_rtc_engine_docs.zip
tag: ${{ needs.release_if_merged.outputs.release_version }}