Skip to content

deploy-front

deploy-front #121

Workflow file for this run

name: API Trigger
on:
# Allows to receive event through the REST API
repository_dispatch:
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: self-hosted
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
name: Checkout repo
- name: Checkout submodules
run: git submodule update --init --recursive --remote
- name: Create env file
run: |
touch .env
export PUBLIC_VERSION=$(jq -r .version utile-front/package.json)
cat << EOF > .env
NOTION_SECRET=${{ secrets.NOTION_SECRET }}
NOTION_DATABASE_ID=${{ secrets.NOTION_DATABASE_ID }}
TWITTER_POST_URL=${{ secrets.TWITTER_POST_URL }}
BOT_TOKEN=${{ secrets.BOT_TOKEN }}
# Front env var, note that the prefix VITE_ is required
PUBLIC_VERSION=${PUBLIC_VERSION}
VITE_API_URL=${{ secrets.API_URL }}
EOF
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Update the stack on the production server
run: docker compose --env-file /etc/environment up --remove-orphans -d ${{ github.event.client_payload.service }}
- name: Cleans up useless images
run: docker image prune --force