Skip to content

1.0.2

1.0.2 #2

Workflow file for this run

name: Production deployment
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
DEPLOYMENT: datafresq
DEPLOYMENT_NAMESPACE: datafresq
DEPLOYMENT_URL: https://datafresq.dataesr.ovh
MM_NOTIFICATION_CHANNEL: bots
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
name: Publish docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: 🏁 Checkout
uses: actions/checkout@v6
- name: 🏷️ Get tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: 🔧 Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: 🔑 Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷️ Extract metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
- name: 🐋 Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
file: Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
secrets: |
NODE_AUTH_TOKEN=${{ secrets.GH_PKG_TOKEN }}
deploy:
name: Update production deployment
runs-on: ubuntu-latest
needs: build-and-push
steps:
- name: Deploy to cluster
id: kubectl-deploy
uses: dataesr/kubectl-deploy@v1.1
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_DOAD_PROD }}
with:
namespace: ${{ env.DEPLOYMENT_NAMESPACE }}
restart: ${{ env.DEPLOYMENT }}
notify:
name: Notify
needs: deploy
if: always()
runs-on: ubuntu-latest
steps:
- uses: dataesr/mm-notifier-action@v1.0.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL }}
deployment_url: ${{ env.DEPLOYMENT_URL }}