[FIX] #19
This file contains hidden or 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: 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: | |
context: . | |
push: true | |
tags: | | |
ghcr.io/mart337i/deploy-it.dk:latest | |
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 |