Skip to content

[REF] Rewrite server into a factory to save it from loading every tim… #57

[REF] Rewrite server into a factory to save it from loading every tim…

[REF] Rewrite server into a factory to save it from loading every tim… #57

Workflow file for this run

name: pipeline
on:
push:
branches:
- main
- develop
permissions:
contents: read
packages: write
id-token: write
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install poetry
poetry install
# - name: Run tests
# run: |
# poetry run pytest -v --import-mode=importlib
build-and-push-image:
runs-on: ubuntu-latest
# needs:
# - run-tests
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
no-cache: true
context: .
push: true
tags: |
ghcr.io/mart337i/deploy-it.dk:${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs:
- build-and-push-image
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create env file
run: |
echo "GIT_COMMIT_HASH=${{ github.sha }}" > ./envfile
- name: Verify deployment files
run: |
test -f compose.yaml || (echo "compose.yaml missing!" && exit 1)
- name: Docker Stack Deploy
uses: cssnr/stack-deploy-action@v1
with:
name: deploy-it
file: compose.yaml
host: deploy-it.dk
user: sysadmin
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
env_file: ./envfile
registry_auth: true
registry_host: ghcr.io
registry_user: mart337i
registry_pass: ${{ secrets.GHCR_PASS }}