Christian Haschek
bd49027ad6
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
46 lines
1.5 KiB
YAML
46 lines
1.5 KiB
YAML
on:
|
|
schedule:
|
|
- cron: '0 3 * * 0,1,6' # at 1:01am on Friday, Saturday and Sunday
|
|
|
|
# on: [push]
|
|
|
|
jobs:
|
|
update_database:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: All tools we need
|
|
run: apt update && apt install -y default-jre git php php-dom php-curl php-sqlite3
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: run crawler
|
|
run: |
|
|
cd crawler
|
|
php crawler.php
|
|
git config --global user.email "gitea@haschek.at"
|
|
git config --global user.name "Gitea"
|
|
git add data.db
|
|
git commit -m "update database"
|
|
git push
|
|
- name: Configure SSH
|
|
env:
|
|
SSH_KEY: ${{ secrets.SSH_KEY }}
|
|
run: |
|
|
mkdir -p ~/.ssh/
|
|
echo "$SSH_KEY" > ~/.ssh/staging.key
|
|
chmod 600 ~/.ssh/staging.key
|
|
- name: Run git pull on Server
|
|
run: |
|
|
ssh -i ~/.ssh/staging.key -o StrictHostKeyChecking=no -p 22 -o UserKnownHostsFile=/dev/null ${{ secrets.SSH_WEBSERVER_IP }} "cd /var/www/dogstats/ && git pull"
|
|
|
|
- name: Prepare
|
|
id: prep
|
|
run: |
|
|
SHORTREF=${GITHUB_SHA::10}
|
|
|
|
# Set output parameters.
|
|
echo ::set-output name=shortref::${SHORTREF}
|
|
- name: Updating version
|
|
run: |
|
|
ssh -i ~/.ssh/staging.key -o StrictHostKeyChecking=no -p 22 -o UserKnownHostsFile=/dev/null ${{ secrets.SSH_WEBSERVER_IP }} "echo v${{ steps.prep.outputs.shortref }} > /var/www/dogstats/web/version.txt"
|
|
|
|
|