Deliver updates to Floorp Browser #361
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |