Check for Tor Browser updates #426
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
name: Check for Tor Browser updates | |
on: | |
schedule: | |
- cron: '0 0 * * *' # daily at 00:00 UTC | |
workflow_dispatch: | |
jobs: | |
check-for-updates: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check for newer x64 Tor Browser release | |
run: | | |
latest=$( \ | |
curl -sSL https://aus1.torproject.org/torbrowser/update_3/release/downloads.json | \ | |
jq -r '.["version"]' \ | |
) | |
current=$(awk -F '=' '/TOR_VERSION_X64/{print $NF; exit}' Dockerfile | tr -d '"') | |
dpkg --compare-versions "$latest" eq "$current" && update=0 || update=1 | |
echo "TB_X64_UPDATED=$update" >> $GITHUB_ENV | |
echo "TB_X64_VERSION=$latest" >> $GITHUB_ENV | |
- name: Update x64 to latest version and commit update | |
if: ${{ env.TB_X64_UPDATED == 0 }} | |
run: | | |
sed -i s/TOR_VERSION_X64=".*"/TOR_VERSION_X64=\"${{ env.TB_X64_VERSION }}\"/g Dockerfile | |
git config --global user.name "github-runner[bot]" | |
git config --global user.email "github-runner[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Updated Tor Browser x64 version to ${{ env.TB_X64_VERSION }} " || echo | |
git push origin ${GITHUB_REF##*/} -f | |
- name: Check for newer arm64 Tor Browser release | |
run: | | |
latest=$( \ | |
curl -sSl https://sourceforge.net/projects/tor-browser-ports/best_release.json | \ | |
jq -r '.["release"]["filename"]' | \ | |
awk -F / '{ print $2 }' \ | |
) | |
current=$(awk -F '=' '/TOR_VERSION_ARM64/{print $NF; exit}' Dockerfile | tr -d '"') | |
dpkg --compare-versions $latest gt $current && update=0 || update=1 | |
echo "TB_ARM64_UPDATED=$update" >> $GITHUB_ENV | |
echo "TB_ARM64_VERSION=$latest" >> $GITHUB_ENV | |
- name: Update arm64 to latest version and commit update | |
if: ${{ env.TB_ARM64_UPDATED == 0 }} | |
run: | | |
sed -i s/TOR_VERSION_ARM64=".*"/TOR_VERSION_ARM64=\"${{ env.TB_ARM64_VERSION }}\"/g Dockerfile | |
git config --global user.name "github-runner[bot]" | |
git config --global user.email "github-runner[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Updated Tor Browser arm64 version to ${{ env.TB_ARM64_VERSION }} " || echo | |
- name: Commit any updates | |
if: ${{ env.TB_X64_UPDATED == 0 || env.TB_ARM64_UPDATED == 0 }} | |
run: | | |
git push origin ${GITHUB_REF##*/} -f |