chore(ansible): ajout de la propriété restart pour automatiser le red… #113
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: Continuous deployment | |
on: | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/metadata-action@v5.5.1 | |
id: meta | |
with: | |
images: ghcr.io/${{ env.IMAGE_NAME }} | |
tags: type=sha,format=short,prefix= | |
- uses: docker/setup-buildx-action@v3 | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: yarn-cache | |
key: cache-${{ hashFiles('.yarnrc.yml') }} | |
- uses: reproducible-containers/buildkit-cache-dance@v3.1.0 | |
with: | |
cache-map: | | |
{ | |
"yarn-cache": "/cache/yarn" | |
} | |
skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
- uses: docker/build-push-action@v5.3.0 | |
with: | |
context: . | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY }} | |
- name: Deploy frontend | |
run: ansible-playbook -i infra/inventories/ovh.yml infra/playbook-frontend.yml -e IMAGE_NAME=ghcr.io/${IMAGE_NAME,,} -e IMAGE_TAG=${GITHUB_SHA::7} |