每月存档 #11
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: 每月存档 | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Create archive directory | |
run: | | |
if [ ! -d "archive" ]; then | |
mkdir archive | |
fi | |
- name: Set timestamp | |
id: timestamp | |
run: echo "::set-output name=timestamp::$(date +'%Y-%m')" | |
- name: Create archive | |
run: tar -czvf "archive/monthly_archive_${{ steps.timestamp.outputs.timestamp }}.tar.gz" hotlist/*.csv | |
- name: Delete original data | |
run: rm -rf hotlist/*.csv | |
- name: Git add and commit | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "archiver actioner" | |
git add . | |
git commit -m "monthly_archive_${{ steps.timestamp.outputs.timestamp }}" | |
git push |