Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
81 lines
2.2 KiB
YAML
81 lines
2.2 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- 'build_*'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
REGISTRY: rgy.angels-dev.fr
|
|
IMAGE_PATH: prod
|
|
IMAGE_NAME: bot_tamiseur
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Build app
|
|
run: npm run build --if-present
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Extract metadata for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PATH }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
# Tag avec le nom du tag Git
|
|
type=ref,event=tag
|
|
labels: |
|
|
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
|
org.opencontainers.image.description=Bot Discord
|
|
org.opencontainers.image.url=https://gitea.zac.ovh/zachary/bot_Tamiseur
|
|
org.opencontainers.image.source=https://gitea.zac.ovh/zachary/bot_Tamiseur
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Generate artifact attestation
|
|
uses: actions/attest-build-provenance@v1
|
|
with:
|
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_PATH }}/${{ env.IMAGE_NAME }}
|
|
subject-digest: ${{ steps.build.outputs.digest }}
|
|
push-to-registry: true
|