forked from TesteurManiak/flutter-gh-pages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
67 lines (67 loc) · 2.36 KB
/
action.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
name: "Deploy Flutter web app to github pages"
description: "Automates the build and deployment of your Flutter web app on Github gh pages"
author: "bluefireteam"
branding:
color: blue
icon: code
inputs:
webRenderer:
description: "Which web renderer to be used, default is auto"
required: false
default: auto
workingDir:
description: "The directory where the project is (default .)"
required: false
default: .
targetBranch:
description: "The branch where the build will be pushed, default is gh-pages"
required: false
default: gh-pages
baseHref:
description: "base href (if applicable)"
required: false
default: "/"
customArgs:
description: 'Custom args like: --dart-define="simple=example"'
required: false
default: ""
compileToWasm:
description: "Compile to wasm, if used this will ignore the webRenderer flag, default is false"
required: false
default: "false"
runs:
using: "composite"
steps:
- run: flutter config --enable-web
shell: bash
working-directory: ${{inputs.workingDir}}
- run: |
if [[ "${{inputs.compileToWasm}}" == "true" ]]; then
flutter build web --release --wasm --base-href ${{inputs.baseHref}} ${{inputs.customArgs}}
else
flutter build web --release --web-renderer=${{inputs.webRenderer}} --base-href ${{inputs.baseHref}} ${{inputs.customArgs}}
fi
shell: bash
working-directory: ${{inputs.workingDir}}
- run: git config user.name github-actions
shell: bash
working-directory: ${{inputs.workingDir}}
- run: git config user.email [email protected]
shell: bash
working-directory: ${{inputs.workingDir}}
- run: git --work-tree build/web add --all
shell: bash
working-directory: ${{inputs.workingDir}}
- name: Create _headers file
run: |
echo "/*" > build/web/_headers
echo " Cross-Origin-Embedder-Policy: credentialless" >> build/web/_headers
echo " Cross-Origin-Opener-Policy: same-origin" >> build/web/_headers
shell: bash
working-directory: ${{inputs.workingDir}}
- run: git commit -m "Automatic deployment by github-actions"
shell: bash
working-directory: ${{inputs.workingDir}}
- run: git push origin HEAD:${{inputs.targetBranch}} --force
shell: bash
working-directory: ${{inputs.workingDir}}