Deliver Floorp Stable updates #28
This file contains hidden or 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
| # 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/. | |
| name: Deliver Floorp Stable updates | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| win-mar-url: | |
| type: string | |
| required: true | |
| description: Windows x86_64 complete MAR file URL | |
| linux-mar-url: | |
| type: string | |
| required: true | |
| description: Linux x86_64 complete MAR file URL | |
| linux-aarch64-mar-url: | |
| type: string | |
| required: true | |
| description: Linux aarch64 complete MAR file URL | |
| mac-mar-url: | |
| type: string | |
| required: true | |
| description: macOS Universal complete MAR file URL | |
| win-meta-url: | |
| type: string | |
| required: true | |
| description: Windows meta.json URL | |
| linux-meta-url: | |
| type: string | |
| required: true | |
| description: Linux x86_64 meta.json URL | |
| linux-aarch64-meta-url: | |
| type: string | |
| required: true | |
| description: Linux aarch64 meta.json URL | |
| mac-meta-url: | |
| type: string | |
| required: true | |
| description: macOS meta.json URL | |
| firefox-version: | |
| type: string | |
| required: true | |
| description: Firefox version (e.g. 124.0) | |
| app-version2: | |
| type: string | |
| required: true | |
| description: App version 2 (e.g. 12.0.0) | |
| jobs: | |
| deliver-stable-updates: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| RELEASE_NOTE_URL: https://blog.floorp.app/categories/release/ | |
| APP_VERSION2: ${{ inputs.app-version2 }} | |
| steps: | |
| - name: Show parameters | |
| run: | | |
| echo Windows MAR : ${{ inputs.win-mar-url }} | |
| echo Linux MAR : ${{ inputs.linux-mar-url }} | |
| echo Linux aarch64 MAR : ${{ inputs.linux-aarch64-mar-url }} | |
| echo macOS MAR : ${{ inputs.mac-mar-url }} | |
| echo App Version 2 : $APP_VERSION2 | |
| echo Firefox Ver : ${{ inputs.firefox-version }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| - name: Prepare workspace | |
| run: mkdir -p ~/update_tmpfiles | |
| - name: Process Windows & Linux MAR | |
| run: | | |
| set -e | |
| process() { | |
| local OS=$1 | |
| local ARCH=$2 | |
| local URL=$3 | |
| local OUT_ENV_PREFIX=$4 # e.g. WIN or LINUX | |
| cd ~/update_tmpfiles | |
| mkdir -p "$OS-$ARCH" | |
| cd "$OS-$ARCH" | |
| wget -nv "$URL" -O file.mar | |
| # size | |
| local SIZE | |
| SIZE=$(stat -c%s "file.mar") | |
| echo "${OUT_ENV_PREFIX}_SIZE=$SIZE" >> $GITHUB_ENV | |
| } | |
| process WINNT x86_64 '${{ inputs.win-mar-url }}' WIN | |
| process Linux x86_64 '${{ inputs.linux-mar-url }}' LINUX | |
| process Linux aarch64 '${{ inputs.linux-aarch64-mar-url }}' LINUX_AARCH64 | |
| - name: Download and process meta.json files | |
| run: | | |
| set -e | |
| cd ~/update_tmpfiles | |
| # Download macOS MAR file for size calculation | |
| wget -nv '${{ inputs.mac-mar-url }}' -O mac-file.mar | |
| echo "MAC_SIZE=$(stat -c%s mac-file.mar)" >> $GITHUB_ENV | |
| # Download meta.json files for each platform | |
| wget -nv '${{ inputs.win-meta-url }}' -O win-meta.json | |
| wget -nv '${{ inputs.linux-meta-url }}' -O linux-meta.json | |
| wget -nv '${{ inputs.linux-aarch64-meta-url }}' -O linux-aarch64-meta.json | |
| wget -nv '${{ inputs.mac-meta-url }}' -O mac-meta.json | |
| # Extract buildid and buildid2 for each platform | |
| echo "WIN_BUILDID=$(jq -r '.buildid' win-meta.json)" >> $GITHUB_ENV | |
| echo "WIN_BUILDID2=$(jq -r '.noraneko_buildid' win-meta.json)" >> $GITHUB_ENV | |
| echo "LINUX_BUILDID=$(jq -r '.buildid' linux-meta.json)" >> $GITHUB_ENV | |
| echo "LINUX_BUILDID2=$(jq -r '.noraneko_buildid' linux-meta.json)" >> $GITHUB_ENV | |
| echo "LINUX_AARCH64_BUILDID=$(jq -r '.buildid' linux-aarch64-meta.json)" >> $GITHUB_ENV | |
| echo "LINUX_AARCH64_BUILDID2=$(jq -r '.noraneko_buildid' linux-aarch64-meta.json)" >> $GITHUB_ENV | |
| echo "MAC_BUILDID=$(jq -r '.buildid' mac-meta.json)" >> $GITHUB_ENV | |
| echo "MAC_BUILDID2=$(jq -r '.noraneko_buildid' mac-meta.json)" >> $GITHUB_ENV | |
| # Set Firefox version | |
| echo "FIREFOX_VERSION=${{ inputs.firefox-version }}" >> $GITHUB_ENV | |
| - name: Create update.xml files | |
| run: | | |
| set -e | |
| make_xml () { | |
| local OS=$1 | |
| local ARCH=$2 | |
| local SIZE=$3 | |
| local MAR_URL=$4 | |
| local BUILDID=$5 | |
| local BUILDID2=$6 | |
| update_xml=( | |
| '<?xml version="1.0" encoding="UTF-8"?>' | |
| '<updates>' | |
| " <update type=\"minor\" displayVersion=\"${FIREFOX_VERSION}@${APP_VERSION2}\" appVersion=\"${FIREFOX_VERSION}\" platformVersion=\"${FIREFOX_VERSION}\" buildID=\"${BUILDID}\" appVersion2=\"${APP_VERSION2}\" buildID2=\"${BUILDID2}\" detailsURL=\"${RELEASE_NOTE_URL}\">" | |
| " <patch type=\"complete\" URL=\"${MAR_URL}\" size=\"${SIZE}\"/>" | |
| ' </update>' | |
| '</updates>' | |
| ) | |
| mkdir -p browser/stable/${OS}/${ARCH} | |
| : > browser/stable/${OS}/${ARCH}/update.xml | |
| for line in "${update_xml[@]}"; do echo "$line" >> browser/stable/${OS}/${ARCH}/update.xml ; done | |
| } | |
| make_xml WINNT x86_64 $WIN_SIZE '${{ inputs.win-mar-url }}' $WIN_BUILDID $WIN_BUILDID2 | |
| make_xml Linux x86_64 $LINUX_SIZE '${{ inputs.linux-mar-url }}' $LINUX_BUILDID $LINUX_BUILDID2 | |
| make_xml Linux aarch64 $LINUX_AARCH64_SIZE '${{ inputs.linux-aarch64-mar-url }}' $LINUX_AARCH64_BUILDID $LINUX_AARCH64_BUILDID2 | |
| make_xml Darwin x86_64 $MAC_SIZE '${{ inputs.mac-mar-url }}' $MAC_BUILDID $MAC_BUILDID2 | |
| make_xml Darwin aarch64 $MAC_SIZE '${{ inputs.mac-mar-url }}' $MAC_BUILDID $MAC_BUILDID2 | |
| - name: Commit and push | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| if git diff --cached --quiet; then | |
| echo "🛈 変更がないためコミットをスキップします。" | |
| exit 0 | |
| fi | |
| git commit -m "Update Floorp Stable update.xml (${APP_VERSION2})" | |
| git pull -r | |
| git push origin |