-
Notifications
You must be signed in to change notification settings - Fork 25
92 lines (76 loc) · 3.14 KB
/
build-chrome-ext.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
84
85
86
87
88
89
90
91
92
name: Build and Package Chrome Extension app
on:
release:
types:
- created
jobs:
build-chrome-extension:
if: contains(github.event.release.tag_name, 'chrome') || (!contains(github.event.release.tag_name, 'linux') && !contains(github.event.release.tag_name, 'windows') && !contains(github.event.release.tag_name, 'chrome'))
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "21.2"
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.24.5"
- run: flutter --version
- name: Install Flutter dependencies
run: flutter pub get
- name: Check if Beta Version
id: check_beta
run: |
if [[ "${{ github.event.release.tag_name }}" == *"beta"* ]]; then
echo "is_beta=true" >> $GITHUB_OUTPUT
else
echo "is_beta=false" >> $GITHUB_OUTPUT
fi
- name: Modify Manifest for Beta
if: steps.check_beta.outputs.is_beta == 'true'
run: |
jq '.name += " (Beta)"' web_chrome_extension/public/manifest.json > web_chrome_extension/public/manifest_tmp.json
mv web_chrome_extension/public/manifest_tmp.json web_chrome_extension/public/manifest.json
- name: Build Chrome Extension
run: bash ./scripts/build_chrome_extension.sh
- name: Get Version from pubspec.yaml
id: get_version
run: |
version_str=$(grep -oP '(?<=^version: ).*' pubspec.yaml | awk '{$1=$1};1')
echo "version_app=${version_str}" >> $GITHUB_OUTPUT
echo "env_version_app=${version_str}" >> $GITHUB_ENV
- name: List build directory contents for debugging
run: ls -R build
- name: Check build directory exists
run: |
echo "Current working directory: $(pwd)"
echo "Contents of current directory:"
ls -la
if [ ! -d "build/chrome-extension" ]; then
echo "Error: build/chrome-extension directory does not exist."
find . -type d -name "chrome-extension"
exit 1
else
echo "build/chrome-extension directory exists."
ls build/chrome-extension
fi
- name: Install 7z
run: sudo apt-get install -y p7zip-full
- name: Zip build folder
run: |
echo "Creating zip file..."
(cd chrome-extension; 7z a -tzip ../../archethic-wallet-chrome-extension-${{ steps.get_version.outputs.version_app }}.zip ./)
working-directory: build
- name: Upload artifact to action
uses: actions/upload-artifact@v4
with:
name: archethic-wallet-chrome-extension-${{ steps.get_version.outputs.version_app }}
path: archethic-wallet-chrome-extension-${{ steps.get_version.outputs.version_app }}.zip
- name: Upload artifact to release
uses: softprops/action-gh-release@v2
with:
files: archethic-wallet-chrome-extension-${{ steps.get_version.outputs.version_app }}.zip