Auto Update #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
# Simple workflow for deploying static content to GitHub Pages | |
name: Auto Update | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
schedule: | |
- cron: "33 3 * * 5" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release: | |
environment: Action Env | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install | |
run: | | |
pip3 install -r requirements.txt | |
- name: Set current date as env variable | |
run: echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Build | |
run: python main.py release --locationiq-api-key "${{ secrets.LOCATIONIQ_API_KEY }}" --country-code "JP" "KR" "TH" | |
- name: Check for changes | |
id: check_changes | |
run: | | |
# Check for any changes in working directory | |
if ! git diff --quiet || git ls-files --others --exclude-standard | grep -q .; then | |
echo "Changes detected in working directory" | |
echo "has_changes=true" >> $GITHUB_OUTPUT | |
else | |
echo "No changes detected in working directory" | |
echo "has_changes=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Display check result | |
run: | | |
if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then | |
echo "✅ 檢測到檔案變更,將進行 commit 和 release" | |
else | |
echo "ℹ️ 沒有檔案變更,跳過 commit 和 release" | |
fi | |
- name: Delete existing nightly release | |
if: steps.check_changes.outputs.has_changes == 'true' | |
run: | | |
gh release delete nightly --yes || true | |
gh api repos/${{ github.repository }}/git/refs/tags/nightly --method DELETE || true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
if: steps.check_changes.outputs.has_changes == 'true' | |
uses: ncipollo/release-action@v1 | |
with: | |
name: Automated Nightly Build ${{ env.TODAY }} | |
artifacts: "output/release.*" | |
body: | | |
這是定期自動生成的 nightly 版本 (包含最新 geodata),可能未經充分測試。建議使用標有 "Latest" 的穩定版本。 | |
如果發現問題請提 issue 並暫時選擇到 [此處](https://github.com/RxChi1d/immich-geodata-zh-tw/releases) 選擇手動發布的 Release 文件。 | |
如果遇到 Immich 沒有更新數據,請手動修改 geodata-date.txt 文件,將其內容中的時間修改為更新的時間(比如當前時間)。 | |
draft: false | |
generateReleaseNotes: false | |
commit: main | |
tag: nightly # Use the fixed 'nightly' tag | |
makeLatest: false # Do NOT mark this as the latest release | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
if: steps.check_changes.outputs.has_changes == 'true' | |
with: | |
commit_message: Auto update reverse geocoding data on ${{ env.TODAY }} | |
file_pattern: meta_data/* |