Skip to content

(B) 📅 Daily Build with auto-update #3

(B) 📅 Daily Build with auto-update

(B) 📅 Daily Build with auto-update #3

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Please write our copyright if you use this file.
# © 2023 Midori Projects & Contributors
#TODO daily build not changed about cache and refactoring
name: "(B) 📅 Daily Build with auto-update"
permissions:
contents: write
discussions: write
on:
workflow_dispatch:
schedule:
- cron: '0 21 * * *'
#----------------------------------------- JOBS -----------------------------------------#
jobs:
get-display-version:
runs-on: ubuntu-latest
outputs:
display-version: ${{ steps.get.outputs.display-version }}
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: 'browser/config/version_display.txt'
- name: Get Display Version
id: get
run: |
echo "display-version=$(cat browser/config/version_display.txt)" >> $GITHUB_OUTPUT
get-inside-version:
runs-on: ubuntu-latest
outputs:
inside-version: ${{ steps.get.outputs.inside-version }}
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: 'browser/config/version.txt'
- name: Get Inside Version
id: get
run: |
echo "inside-version=$(cat browser/config/version.txt)" >> $GITHUB_OUTPUT
get-buildid:
runs-on: ubuntu-latest
outputs:
buildids: ${{ steps.get.outputs.bid }}
steps:
- id: get
shell: bash -xe {0}
run: |
bdat=`date +"%Y%m%d%I%M%S"`
echo "bid=${bdat}" >> $GITHUB_OUTPUT
#----------------------------------------- WIN -----------------------------------------#
#? Original branding of the code is official
#? It seems in PGO build, branding is not important in NOT deploying binary
build-win-x86_64-profgen:
uses: ./.github/workflows/windows-build.yml
with:
profgen: true
aarch64: false
zstd: true
win-x86_64-gen-profdata-and-jarlog:
needs: build-win-x86_64-profgen
runs-on: windows-2022
steps:
- uses: actions/download-artifact@v3
name: Download artifact 📥
with:
name: midori-windows-x86_64-build-with-profgen-zstd
path: C:\artifact
- name: Unpack artifact
run: |
cd C:\artifact
zstd -d midori-*.tar.zst
7z x midori-*.tar
- uses: actions/checkout@v3
name: Clone 🧬
- name: Setup 🪛
run: |
(New-Object System.Net.WebClient).DownloadFile("https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe","C:\MozillaBuildSetup-Latest.exe")
C:\MozillaBuildSetup-Latest.exe /S | out-null
- name: Generate 🔄
run: |
$workspace_dir = [regex]::replace($env:GITHUB_WORKSPACE, "^([A-Z]):", { "/" + $args.value.Substring(0, 1).toLower() }) -replace "\\","/"
echo "cd $workspace_dir" '' >> mozilla-build-run.sh
echo 'export PATH=/c/mozilla-build/msys2/usr/bin:$PATH' '' >> mozilla-build-run.sh
echo './mach --no-interactive bootstrap --application-choice browser' '' >> mozilla-build-run.sh
echo 'LLVM_PROFDATA=/c/Users/runneradmin/.mozbuild/clang/bin/llvm-profdata.exe JARLOG_FILE=en-US.log ./mach python build/pgo/profileserver.py --binary /c/artifact/midori/midori.exe' '' >> mozilla-build-run.sh
C:\mozilla-build\start-shell.bat $workspace_dir\mozilla-build-run.sh
- name: Publish 🎁
uses: actions/upload-artifact@v3
with:
name: midori-windows-x86_64-profdata-and-jarlog
path: |
merged.profdata
en-US.log
build-win-x86_64-with-profdata-and-jarlog:
needs: [win-x86_64-gen-profdata-and-jarlog,get-buildid]
uses: ./.github/workflows/windows-build.yml
with:
aarch64: false
mar: true
beta: true
profdata_jarlog_artifact_name: "midori-windows-x86_64-profdata-and-jarlog"
out_artifact_name: please-use-this-midori-windows-x86_64-package-build-with-profdata-and-jarlog
MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}}
win-x86_64-gen-update-xml:
needs: [get-display-version, get-buildid, get-inside-version,build-win-x86_64-with-profdata-and-jarlog]
runs-on: ubuntu-latest
steps:
- name: generate update XML file
run: |
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<updates>
<update
type=\"minor\"
displayVersion=\"${DISPVER}\"
appVersion=\"${INSDVER}\"
platformVersion=\"${INSDVER}\"
buildID=\"${BUILDID}\"
detailsURL=\"https://astian.org/midori-en/\"
>
<patch
type=\"complete\"
URL=\"https://github.com/${GHREPO}/releases/download/beta/${MAR_NAME}\"
size=\"${MAR_SIZE}\"
/>
</update>
</updates>" > WINNT-x86_64.xml
env:
DISPVER: ${{needs.get-display-version.outputs.display-version}}
INSDVER: ${{needs.get-inside-version.outputs.inside-version}}
BUILDID: ${{needs.get-buildid.outputs.buildids}}
GHREPO: ${{github.repository}}
MAR_NAME: ${{needs.build-win-x86_64-with-profdata-and-jarlog.outputs.mar_name}}
MAR_SIZE: ${{needs.build-win-x86_64-with-profdata-and-jarlog.outputs.mar_size}}
- name: Publish 🎁
uses: actions/upload-artifact@v3
with:
name: update-xml-midori-win-x86_64
path: |
WINNT-x86_64.xml
#----------------------------------------- LINUX -----------------------------------------#
build-linux-x86_64-PGO:
uses: ./.github/workflows/linux-build.yml
needs: [get-buildid]
with:
aarch64: false
beta: true
mar: true
MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}}
linux-x86_64-gen-update-xml:
runs-on: 'ubuntu-latest'
needs: [build-linux-x86_64-PGO,get-display-version,get-inside-version,get-buildid]
steps:
- name: generate update XML file
run: |
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<updates>
<update
type=\"minor\"
displayVersion=\"${DISPVER}\"
appVersion=\"${INSDVER}\"
platformVersion=\"${INSDVER}\"
buildID=\"${BUILDID}\"
detailsURL=\"https://astian.org/midori-en/\"
>
<patch
type=\"complete\"
URL=\"https://github.com/${GHREPO}/releases/download/beta/${MAR_NAME}\"
size=\"${MAR_SIZE}\"
/>
</update>
</updates>" > LINUX-x86_64.xml
env:
DISPVER: ${{needs.get-display-version.outputs.display-version}}
INSDVER: ${{needs.get-inside-version.outputs.inside-version}}
BUILDID: ${{needs.get-buildid.outputs.buildids}}
GHREPO: ${{github.repository}}
MAR_NAME: ${{needs.build-linux-x86_64-PGO.outputs.mar_name}}
MAR_SIZE: ${{needs.build-linux-x86_64-PGO.outputs.mar_size}}
- name: Publish 🎁
uses: actions/upload-artifact@v3
with:
name: update-xml-midori-linux-x86_64
path: |
LINUX-x86_64.xml
#----------------------------------------- macOS -----------------------------------------#
build-mac-universal-profgen:
uses: ./.github/workflows/macOS-Universal.yml
with:
profgen: true
secrets:
MACOS_CROSS_TOOLS_KEY: ${{ secrets.MACOS_CROSS_TOOLS_KEY }}
mac-universal-gen-profdata-and-jarlog:
needs: [build-mac-universal-profgen]
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
# GitHub doesn't support M1 macs yet, so we need to use a self-hosted runner.
runs-on: [macos-latest, self-hosted]
# macos-latest is x86_64, self-hosted is arm64
steps:
- name: Init
run: |
export RUNNER_USERDIR=`echo ~`
echo "RUNNER_USERDIR=$RUNNER_USERDIR" >> $GITHUB_ENV
mkdir -p ~/downloads/artifacts
- name: Clean up (Self-hosted only)
if: ${{ matrix.runs-on == 'self-hosted' }}
run: |
rm -rf ~/downloads/artifacts
rm -rf ./midori
- uses: actions/checkout@v3
name: Clone 🧬
- name: Check Arch type
shell: bash
run: |
if [[ $GHA_BUILD_MACHINE != 'macos-latest' ]]; then
export ARCH_TYPE=`echo "aarch64"`
echo "ARCH_TYPE=$ARCH_TYPE" >> $GITHUB_ENV
else
export ARCH_TYPE=`echo "x86_64"`
echo "ARCH_TYPE=$ARCH_TYPE" >> $GITHUB_ENV
fi
env:
GHA_BUILD_MACHINE: ${{ matrix.runs-on }}
- uses: actions/download-artifact@v3
id: download-artifacts-mac-enable-profgen
name: Download artifact 📥
with:
name: midori-mac-${{ env.ARCH_TYPE }}-build-with-profgen
path: ~/downloads/artifacts
- name: setup environment 🌲
run: |
echo -e "ac_add_options --enable-bootstrap" >> mozconfig
echo 'mozconfig: **********************'
cat ./mozconfig
echo '*********************************'
brew install gnu-tar
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH
./mach --no-interactive bootstrap --application-choice browser
- name: Extract artifact 📂
run: |
mkdir -p ./midori
cp ${{ steps.download-artifacts-mac-enable-profgen.outputs.download-path }}/${ARCH_TYPE}-apple-darwin-output.tar.xz ./
tar xf ${ARCH_TYPE}-apple-darwin-output.tar.xz
- name: Generate Profdata 📊
run: |
LLVM_PROFDATA=$RUNNER_USERDIR/.mozbuild/clang/bin/llvm-profdata JARLOG_FILE=en-US.log ./mach python build/pgo/profileserver.py --binary ./obj-${ARCH_TYPE}-apple-darwin/dist/midori/Midori.app/Contents/MacOS/midori
env:
GHA_BUILD_MACHINE: ${{ matrix.runs-on }}
- name: Publish 🎁
uses: actions/upload-artifact@v3
with:
name: midori-${{ env.ARCH_TYPE }}-apple-darwin-profdata-and-jarlog
path: |
merged.profdata
en-US.log
build-mac-universal-with-profdata:
uses: ./.github/workflows/macOS-Universal.yml
needs: [get-buildid, mac-universal-gen-profdata-and-jarlog]
with:
build-with-profdata-and-jarlog: true
beta: true
MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}}
secrets:
MACOS_CROSS_TOOLS_KEY: ${{ secrets.MACOS_CROSS_TOOLS_KEY }}
create-mac-universal-artifact:
uses: ./.github/workflows/macOS-integration.yml
needs: [get-buildid, get-display-version, get-inside-version, build-mac-universal-with-profdata]
with:
beta: true
mar: true
x86_64_artifact_name: midori-mac-x86_64-package
aarch64_artifact_name: midori-mac-aarch64-package
display_version: ${{needs.get-display-version.outputs.display-version}}
inside_version: ${{needs.get-inside-version.outputs.inside-version}}
MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}}
secrets:
macOS_CERTIFICATES_P12_For_App_BASE64: ${{ secrets.macOS_CERTIFICATES_P12_For_App_BASE64 }}
macOS_CERTIFICATES_P12_PASSWORD: ${{ secrets.macOS_CERTIFICATES_P12_PASSWORD }}
macOS_AppleDeveloperId: ${{ secrets.macOS_AppleDeveloperId }}
macOS_AppleAccountId: ${{ secrets.macOS_AppleAccountId }}
macOS_AppleTeamId: ${{ secrets.macOS_AppleTeamId }}
macOS_AppleAccountAppSpecificPassword: ${{ secrets.macOS_AppleAccountAppSpecificPassword }}
##################################################################### Deployments #######################################################################################################
Deployments:
needs: [get-display-version, get-buildid, get-inside-version, linux-x86_64-gen-update-xml, win-x86_64-gen-update-xml, create-mac-universal-artifact]
runs-on: ubuntu-latest
steps:
- name: Release version & date📦
run: |
echo "Release version: ${{ needs.get-display-version.outputs.display-version }}"
echo "Release date: ${{ needs.get-buildid.outputs.buildids }}"
- name: make directory 📁
run: |
mkdir -p ~/downloads/artifacts
mkdir -p ~/downloads/artifacts/linux-x64
mkdir -p ~/downloads/artifacts/windows-x64
mkdir -p ~/downloads/artifacts/macOS-x64
- name: download Linux x86_64 build artifact 📥
uses: actions/download-artifact@v3
with:
name: midori-linux-x64
path: ~/downloads/artifacts/linux-x64
- name: download Linux x86_64 build artifact 📥
uses: actions/download-artifact@v3
with:
name: update-xml-midori-linux-x86_64
path: ~/downloads/artifacts/linux-x64
- name: download Windows x86_64 build artifact📥
uses: actions/download-artifact@v3
with:
name: please-use-this-midori-windows-x86_64-package-build-with-profdata-and-jarlog
path: ~/downloads/artifacts/windows-x64
- name: download Windows x86_64 update xml📥
uses: actions/download-artifact@v3
with:
name: update-xml-midori-win-x86_64
path: ~/downloads/artifacts/windows-x64
- name: download macOS Universal build artifact📥
uses: actions/download-artifact@v3
with:
name: Universal-Artifact
path: ~/downloads/artifacts/macOS-x64
- name: check file structure 🗃
run: |
cd ~/downloads/artifacts
echo "current directory: $PWD"
echo "****************************************************************************************************"
find . -print | sed -e "s;[^/]*/;|____;g;s;____|; |;g"
echo "****************************************************************************************************"
- name: Deploy to GitHub Releases 🚀
id: create_release
uses: "softprops/action-gh-release@v1"
with:
files: |
/home/runner/downloads/artifacts/linux-x64/LINUX-x86_64.mar
/home/runner/downloads/artifacts/windows-x64/WINNT-x86_64.mar
/home/runner/downloads/artifacts/macOS-x64/DARWIN-Universal.mar
/home/runner/downloads/artifacts/linux-x64/midori-*.linux-x86_64.tar.bz2
/home/runner/downloads/artifacts/windows-x64/midori-win64.installer.exe
/home/runner/downloads/artifacts/windows-x64/midori-*.en-US.win64.zip
/home/runner/downloads/artifacts/macOS-x64/midori-macOS-universal.dmg
/home/runner/downloads/artifacts/windows-x64/WINNT-x86_64.xml
/home/runner/downloads/artifacts/linux-x64/LINUX-x86_64.xml
/home/runner/downloads/artifacts/macOS-x64/DARWIN-Universal.xml
tag_name: "beta"
name: "Midori beta build: v${{ needs.get-display-version.outputs.display-version }} | ${{ needs.get-buildid.outputs.buildids }}"
body: |
"Midori Daylight": v${{ needs.get-display-version.outputs.display-version }} (Firefox v${{ needs.get-inside-version.outputs.inside-version }})
**This is NOT the release (stable) channel version of Midori. This is a beta build of Midori. It is intended for testing purposes only. It is not recommended that you use this version of Midori for daily browsing. If you would like to download the release version of Midori, please visit [astian.org](https://astian.org/midori-browser).**
draft: false
prerelease: true
token: ${{ github.token }}
env:
GITHUB_REPOSITORY: ${{ github.repository }}