Skip to content

.github/workflows/zen-browser-sync.yml #5950

.github/workflows/zen-browser-sync.yml

.github/workflows/zen-browser-sync.yml #5950

# Controls when the workflow will run
on:
# Run on commit
push:
# Triggers the workflow daily
# Zen tends to update a lot, so we run this every 10 minutes
schedule:
- cron: '*/10 * * * *'
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
ref: 'main'
- name: Set commit author
run: |
git config --local user.name "Updater"
git config --local user.email "[email protected]"
- name: Update zen-browser.spec
# Copr doesn't like using dashes for the version, so we have to manually change it to something it likes but keep it the same for
# the source repo.
run: |
ZEN_VER=$(curl -s https://api.github.com/repos/zen-browser/desktop/releases | jq -r 'first(.[].tag_name | select(test("^[0-9]")))')
ZEN_VER_SPEC=$(echo $ZEN_VER | sed 's@-@.@g')
sed -i '0,/Version:.*/s//Version: '$ZEN_VER_SPEC'/' /home/runner/work/copr/copr/zen-browser/zen-browser.spec
sed -i '0,/Version:.*/s//Version: '$ZEN_VER_SPEC'/' /home/runner/work/copr/copr/zen-browser/zen-browser-aarch64.spec
sed -i 's@https://github.com/zen-browser/desktop/releases/download/.*@https://github.com/zen-browser/desktop/releases/download/'$ZEN_VER'/zen.linux-x86_64.tar.bz2@g' /home/runner/work/copr/copr/zen-browser/zen-browser.spec
sed -i 's@https://github.com/zen-browser/desktop/releases/download/.*@https://github.com/zen-browser/desktop/releases/download/'$ZEN_VER'/zen.linux-aarch64.tar.bz2@g' /home/runner/work/copr/copr/zen-browser/zen-browser-aarch64.spec
- name: update-zen-browser-twilight-spec
id: update_twilight
run: |
ZEN_VER_TWILIGHT=$(curl -s https://api.github.com/repos/zen-browser/desktop/releases | jq -r '[.[] | select(.prerelease == true)][0].id')
OLD_VER=$(grep '^Version:' /home/runner/work/copr/copr/zen-browser/zen-twilight.spec | awk '{print $2}')
sed -i '0,/Version:.*/s//Version: '$ZEN_VER_TWILIGHT'/' /home/runner/work/copr/copr/zen-browser/zen-twilight.spec
sed -i '0,/Version:.*/s//Version: '$ZEN_VER_TWILIGHT'/' /home/runner/work/copr/copr/zen-browser/zen-twilight-aarch64.spec
if [ "$ZEN_VER_TWILIGHT" != "$OLD_VER" ]; then
echo "::set-output name=twilight_version_changed::true"
else
echo "::set-output name=twilight_version_changed::false"
fi
- name: Push updated version to the repository
id: github-push
run: |
git config pull.rebase true
git add .
git diff-index --quiet HEAD || git commit -m "chore(zen-browser): Sync Zen version"
git push