-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 1.66 KB
/
main.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
name: Main Release
on:
push:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Get Pubspec Version
id: version-step
run: |
export VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if version is used
run: |
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }}
echo "$URL"
CODE=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ "$CODE" != 404 ]; then
echo "Release '$VERSION' already exists. ($CODE)"
exit 1
fi
- name: Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Flutter Pub Get
timeout-minutes: 2
run: flutter pub get
- name: Flutter Build Web
timeout-minutes: 10
run: flutter build web
- name: Publishing to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./build/web
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Creating a GitHub Tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ env.VERSION }}
tag_prefix: ''
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}