Skip to content

Update build.sh

Update build.sh #19

Workflow file for this run

name: Update
on:
push:
branches: [dev]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: write
jobs:
check-for-update:
runs-on: ubuntu-latest
outputs:
requires_update: ${{ steps.check.outputs.requires_update }}
latest_version: ${{ steps.check.outputs.latest_version }}
latest_version_download_url: ${{ steps.check.outputs.latest_version_download_url }}
steps:
- uses: actions/checkout@v4
- id: check
run: |
latest_release_data=$(curl -L https://api.github.com/repos/TeamNewPipe/NewPipe-nightly/releases/latest)
latest_release_name=$(echo "$latest_release_data" | jq '.name')
echo "Latest version is \'$latest_release_name\'"
current_deployed_release=$(cat current.txt || echo "")
echo "Currently deployed version is \'$current_deployed_release\'"
if [[ "$latest_release_name" == "$current_deployed_release" ]]; then
echo "requires_update=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "requires_update=true" >> "$GITHUB_OUTPUT"
echo "latest_version=$latest_release_name" >> "$GITHUB_OUTPUT"
latest_version_download_url=$(echo "$latest_release_data" | grep "browser_download_url.*apk" | cut -d : -f 2,3 | tr -d \" )
echo "Latest version download url is \'$latest_version_download_url\'"
echo "latest_version_download_url=$latest_version_download_url" >> "$GITHUB_OUTPUT"
update:
runs-on: ubuntu-latest
needs: check-for-update
if: ${{ needs.check-for-update.outputs.requires_update }}
steps:
- uses: actions/checkout@v4
- name: Download assets
run: |
mkdir -p apks
echo "${{ needs.check-for-update.outputs.latest_version_download_url }}" | wget -P apks --no-verbose -i -
ls -lha apks
- name: Load KeyStore file
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d - > repo/keystore.p12
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build F-Droid Repo Generator
uses: docker/build-push-action@v6
with:
context: ./fdroid-repo-generator
load: true
tags: fdroid-repo-generator
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,compression=zstd
- run: |
mkdir -p ./deploy/fdroid
touch ./deploy/fdroid/.nojekyll
- name: Run F-Droid Repo Generator
run: |
docker run --rm \
-v $(pwd)/apks:/apks \
-v $(pwd)/deploy:/deploy \
-v $(pwd)/repo:/repobase \
-w /repo \
-e REPO_KEYALIAS="${{ secrets.REPO_KEYALIAS }}" \
-e KEYSTOREPASS="${{ secrets.KEYSTOREPASS }}" \
-e KEYPASS="${{ secrets.KEYPASS }}" \
-e KEYDNAME="${{ secrets.KEYDNAME }}" \
fdroid-repo-generator
- name: Deploy to Github pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy/fdroid
# - name: Update currently deployed version
# run: |
# echo "${{ needs.check-for-update.outputs.latest_version }}" > current.txt
# TODO Commit and push