-
Notifications
You must be signed in to change notification settings - Fork 133
83 lines (78 loc) · 2.37 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: Publish to pub.dev
on:
push:
branches: [ master ]
jobs:
check-release-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare tag
id: prepare_tag
continue-on-error: true
run: |
export TAG=v$(yq '.version' pubspec.yaml)
echo "TAG=$TAG" >> $GITHUB_ENV
export CHECK_TAG=$(git tag | grep $TAG)
if [[ $CHECK_TAG ]]; then
echo "Skipping because release tag already exists"
exit 1
fi
- name: Output
id: release_output
if: ${{ steps.prepare_tag.outcome == 'success' }}
run: |
echo "::set-output name=tag::${{ env.TAG }}"
outputs:
tag: ${{ steps.release_output.outputs.tag }}
publish:
runs-on: ubuntu-latest
needs: check-release-tag
if: ${{ needs.check-release-tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
- name: 'publish pusher-channels-flutter package'
id: publish
uses: k-paxian/dart-package-publisher@master
with:
format: true
skipTests: true
flutter: true
dryRunOnly: false
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
create-github-release:
runs-on: ubuntu-latest
needs: publish
if: ${{ needs.check-release-tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
- name: Prepare tag
run: |
export TAG=v$(yq '.version' pubspec.yaml)
echo "PRE_RELEASE=false" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Check pre release
if: contains(env.TAG, 'beta')
run: echo "PRE_RELEASE=true" >> $GITHUB_ENV
- name: Setup git
run: |
git config user.email "[email protected]"
git config user.name "Pusher CI"
- name: Prepare description
run: |
csplit -s CHANGELOG.md "/##/" {1}
cat xx01 > CHANGELOG.tmp
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.TAG }}
body_path: CHANGELOG.tmp
draft: false
prerelease: ${{ env.PRE_RELEASE }}