Skip to content

Update dependency ansible to v10 #469

Update dependency ansible to v10

Update dependency ansible to v10 #469

Workflow file for this run

name: ci
on: [push]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install -y --no-install-recommends git-crypt
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/setup-python@v4
with:
python-version: '3.12.x'
- name: Initialize Git
run: |
git config --global user.name "Deployer"
git config --global user.email "[email protected]"
# This has been added as a deploy key to https://github.com/blindern/deployer-test
# It can easily be regenerated, just remember to add it to the repo.
- name: Install SSH key
env:
GIT_SSH_KEY: ${{ secrets.GIT_SSH_KEY }}
run: |
mkdir -p ~/.ssh
echo "$GIT_SSH_KEY" >~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
- run: pip install poetry
- run: poetry install
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
- run: poetry run pre-commit run --all-files
- run: poetry run pytest
- name: Build container
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: blindern/deployer:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy secondary from primary
if: github.ref == 'refs/heads/main'
run: |
curl --fail -L -i -H "authorization: bearer $DEPLOYER_TOKEN" -H "content-type: application/json" -X POST https://deployer.foreningenbs.no/deploy -d '
{
"service": "deployer-secondary",
"attributes": {
"image": "blindern/deployer@${{ steps.docker_build.outputs.digest }}"
}
}'
env:
DEPLOYER_TOKEN: ${{ secrets.DEPLOYER_TOKEN }}
- name: Deploy primary from secondary
if: github.ref == 'refs/heads/main'
run: |
curl --fail -L -i -H "authorization: bearer $DEPLOYER_TOKEN" -H "content-type: application/json" -X POST https://deployer-secondary.foreningenbs.no/deploy -d '
{
"service": "deployer-primary",
"attributes": {
"image": "blindern/deployer@${{ steps.docker_build.outputs.digest }}"
}
}'
env:
DEPLOYER_TOKEN: ${{ secrets.DEPLOYER_TOKEN }}