-
-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (146 loc) · 5.89 KB
/
deliver-updates-to-floorp-browser.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
on:
workflow_dispatch:
inputs:
mar-url:
type: string
required: true
description: URL of mar file
os:
type: choice
options:
- WINNT
- Linux
- Darwin
required: true
description: OS
arch:
type: choice
options:
- x86_64
- x86
- aarch64
required: true
description: Architecture
buildid:
type: string
required: false
description: BuildID
firefox-version:
type: string
required: false
description: Firefox Version
display-version:
type: string
required: false
description: Display Version
release-note-url:
type: string
default: https://blog.ablaze.one/category/ablaze/ablaze-project/floorp/
required: false
description: Release Note URL
name: Deliver updates to Floorp Browser
jobs:
deliver-updates:
runs-on: ubuntu-22.04
steps:
- name: Details
run: |
echo URL of mar file: ${{ inputs.mar-url }}
echo OS: ${{ inputs.os }}
echo Architecture: ${{ inputs.arch }}
echo "TARGET_OS=${{ inputs.os }}" >> $GITHUB_ENV
- name: Clone
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
- name: Calculate mar file size
run: |
mkdir ~/update_tmpfiles
cd ~/update_tmpfiles
wget -nv "${{ inputs.mar-url }}" -O file.mar
MAR_FILE_SIZE=$(ls -l file.mar | awk '{print $5}')
echo "MAR_FILE_SIZE=$MAR_FILE_SIZE" >> $GITHUB_ENV
- name: Get Display Version, BuildID and Firefox Version for Linux & Windows
if: env.TARGET_OS != 'Darwin'
run: |
cd ~/update_tmpfiles
wget -nv https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.cache.level-3.toolchains.v3.linux64-mar-tools.latest/artifacts/public%2Fbuild%2Fmar-tools.tar.zst -O mar-tools.tar.zst
tar -xvf mar-tools.tar.zst
mkdir mar_tmp
cd ./mar_tmp
~/update_tmpfiles/mar-tools/mar -x ~/update_tmpfiles/file.mar
cd ../
cp ./mar_tmp/application.ini application.ini.xz
xz -d application.ini.xz
cp ./mar_tmp/omni.ja omni.ja.xz
xz -d omni.ja.xz
mkdir omni_tmp
set +e
unzip -d ./omni_tmp omni.ja
set -e
cp ./omni_tmp/modules/AppConstants.* AppConstants.jsfile
DISPLAY_VERSION=$(cat "AppConstants.jsfile" | grep "MOZ_APP_VERSION_DISPLAY: " | awk '{print $2}' | sed 's/^"//' | sed 's/",$//')
BUILDID=$(cat "application.ini" | grep "^BuildID=" | awk -F= '{print $2}')
FIREFOX_VERSION=$(cat "application.ini" | grep "^Version=" | awk -F= '{print $2}' | sed "s/\.0$//")
echo "Display Version: ${DISPLAY_VERSION}"
echo "DISPLAY_VERSION=$DISPLAY_VERSION" >> $GITHUB_ENV
echo "BUILDID=$BUILDID" >> $GITHUB_ENV
echo "FIREFOX_VERSION=$FIREFOX_VERSION" >> $GITHUB_ENV
echo BuildID: ${BUILDID}
echo Firefox Verison: ${FIREFOX_VERSION}
- name: Get Display Version, BuildID and Firefox Version for macOS
if: env.TARGET_OS == 'Darwin'
run: |
echo "DISPLAY_VERSION=${{ inputs.display-version }}" >> $GITHUB_ENV
echo "BUILDID=${{ inputs.buildid }}" >> $GITHUB_ENV
echo "FIREFOX_VERSION=${{ inputs.firefox-version }}" >> $GITHUB_ENV
echo "Display Version: ${{ inputs.display-version }}"
echo "BuildID: ${{ inputs.buildid }}"
echo "Firefox Version: ${{ inputs.firefox-version }}"
- name: Create files
run: |
cd ~/update_tmpfiles
xml_found=(
'<?xml version="1.0" encoding="UTF-8"?>'
'<updates>'
' <update type="minor" displayVersion="${{ env.DISPLAY_VERSION }}" appVersion="${{ env.FIREFOX_VERSION }}" platformVersion="${{ env.FIREFOX_VERSION }}" buildID="${{ env.BUILDID }}" detailsURL="${{ inputs.release-note-url }}">'
' <patch type="complete" URL="${{ inputs.mar-url }}" size="${{ env.MAR_FILE_SIZE }}"/>'
' </update>'
'</updates>'
)
xml_notfound=(
'<?xml version="1.0" encoding="UTF-8"?>'
'<updates>'
'</updates>'
)
xml_addon=(
'<?xml version="1.0"?>'
'<updates>'
'</updates>'
)
for line in "${xml_found[@]}" ; do echo $line >> update_found.xml ; done
for line in "${xml_notfound[@]}" ; do echo $line >> update_notfound.xml ; done
for line in "${xml_addon[@]}" ; do echo $line >> update_addon.xml ; done
- name: Copy files
run: |
mkdir -p browser/${{ env.DISPLAY_VERSION }}/${{ inputs.os }}/${{ inputs.arch }}
for dir in $(ls -l browser | grep ^d | awk '{print $9}'); do
echo $dir
mkdir -p browser/${dir}/${{ inputs.os }}/${{ inputs.arch }}
if [[ "$dir" != "beta" ]]; then
if [[ "$dir" == "${{ env.DISPLAY_VERSION }}" ]]; then
cp ~/update_tmpfiles/update_notfound.xml browser/${dir}/${{ inputs.os }}/${{ inputs.arch }}/update.xml
else
cp ~/update_tmpfiles/update_found.xml browser/${dir}/${{ inputs.os }}/${{ inputs.arch }}/update.xml
fi
fi
done
mkdir -p systemAddon/xml/${{ env.DISPLAY_VERSION }}/${{ inputs.os }}
cp ~/update_tmpfiles/update_addon.xml systemAddon/xml/${{ env.DISPLAY_VERSION }}/${{ inputs.os }}/update.xml
- name: Commit
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "A new version of Floorp Browser has been released!"
git push origin