Skip to content

Update links

Update links #1826

Workflow file for this run

name: Update links
on:
schedule:
- cron: "0 */4 * * *"
push:
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup folder
run: |
mkdir -p links
- name: Get links
id: get_links
run: |
echo "Getting arknights link..."
ak_link=`curl -sI https://ak.hypergryph.com/downloads/android_lastest | \
grep -m 1 -oE "https://ak.hycdn.cn/apk/.*\.apk"`
echo "ak_link=$ak_link" | tee -a $GITHUB_OUTPUT
echo "Getting skland link..."
sk_link=`curl -s --header 'Origin: https://www.skland.com' https://assets.skland.com/common-config/json/app-config.json | \
jq -r ".downloadUrl.android"`
echo "sk_link=$sk_link" | tee -a $GITHUB_OUTPUT
- name: Update links
run: |
cp README-template.md README.md
if diff links/arknights <(echo ${{ steps.get_links.outputs.ak_link }}) &> /dev/null; then
echo "No update needed for arknights link."
sed -i "s|{{arknights_timestamp}}|$(git log -1 --pretty=%ct links/arknights)|" README.md
else
echo "Updating arknights link..."
echo ${{ steps.get_links.outputs.ak_link }} > links/arknights
sed -i "s|{{arknights_timestamp}}|$(date +%s)|" README.md
fi
sed -i "s|{{arknights_link}}|$(cat links/arknights)|" README.md
if diff links/skland <(echo ${{ steps.get_links.outputs.sk_link }}) &> /dev/null; then
echo "No update needed for skland link."
sed -i "s|{{skland_timestamp}}|$(git log -1 --pretty=%ct links/skland)|" README.md
else
echo "Updating skland link..."
echo ${{ steps.get_links.outputs.sk_link }} > links/skland
sed -i "s|{{skland_timestamp}}|$(date +%s)|" README.md
fi
sed -i "s|{{skland_link}}|$(cat links/skland)|" README.md
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5