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
Chris 0f13bdea27
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
shortref is now 10
2023-10-26 16:44:36 +02:00

36 lines
1.2 KiB
YAML

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:
#if: "contains(github.event.head_commit.message, 'push')"
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
- 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"