This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
dogstats/.gitea/workflows/build.yml

36 lines
1.2 KiB
YAML
Raw Normal View History

2023-10-19 10:46:59 +02:00
name: Build and push
run-name: ${{ github.actor }} building dogstats
on: [push]
env:
REGISTRY: gitea.haschek.at
IMAGE_NAME: $(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
jobs:
pull-on-server:
2023-10-20 20:48:58 +02:00
#if: "contains(github.event.head_commit.message, 'push')"
2023-10-19 10:46:59 +02:00
name: Pulling repo on server
runs-on: ubuntu-latest
steps:
- name: Configure SSH
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
2023-10-26 11:15:39 +02:00
- name: Run git pull on Server
2023-10-19 10:46:59 +02:00
run: |
2023-10-21 20:56:12 +02:00
ssh -i ~/.ssh/staging.key -o StrictHostKeyChecking=no -p 22 -o UserKnownHostsFile=/dev/null ${{ secrets.SSH_WEBSERVER_IP }} "cd /var/www/dogstats/ && git pull"
2023-10-26 11:15:39 +02:00
- name: Prepare
id: prep
run: |
2023-10-26 16:44:36 +02:00
SHORTREF=${GITHUB_SHA::10}
2023-10-26 11:15:39 +02:00
# Set output parameters.
echo ::set-output name=shortref::${SHORTREF}
- name: Updating version
run: |
2023-10-26 11:18:29 +02:00
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"
2023-10-21 20:56:12 +02:00