fix; #23
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: test and deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
PYTHON_VERSION: "3.11" | |
POETRY_VERSION: "1.6.1" | |
DEPLOY_PATH: "/var/www/pinger" | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Setup git user | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git commit --allow-empty -m "CI Deploy [ci skip]" | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Test | |
run: | | |
poetry run python pinger/test_main.py | |
deploy: | |
name: pipx install on server | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Copy run.sh | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ vars.DEPLOY_HOST }} | |
username: ${{ vars.GH_SSH_USERNAME }} | |
key: ${{ secrets.GH_SSH_PRIVATE_KEY }} | |
port: ${{ vars.DEPLOY_PORT }} | |
source: "run.sh" | |
target: "${{ env.DEPLOY_PATH }}" | |
overwrite: true | |
- name: pipx install | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ vars.DEPLOY_HOST }} | |
username: ${{ vars.GH_SSH_USERNAME }} | |
key: ${{ secrets.GH_SSH_PRIVATE_KEY }} | |
port: ${{ vars.DEPLOY_PORT }} | |
script_stop: true | |
script: | | |
exec bashfix; | |
cd ${{ env.DEPLOY_PATH }} | |
pipx install -f git+https://github.com/aarhusstadsarkiv/pinger.git@${{ github.sha }} | |
pipx ensurepath | |
kill $(ps aux | grep 'pinger' | awk '{print $2}') | |
./run.sh |