mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-01-14 15:54:13 +01:00
fix: améliorer le déploiement avec Cloudflare Wrangler en capturant l'URL de déploiement
This commit is contained in:
23
.github/workflows/cloudflare.yml
vendored
23
.github/workflows/cloudflare.yml
vendored
@@ -59,13 +59,19 @@ jobs:
|
|||||||
echo "env_name=Preview" >> $GITHUB_OUTPUT
|
echo "env_name=Preview" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Run Cloudflare Wrangler
|
- name: Run Cloudflare Wrangler & Capture URL
|
||||||
uses: cloudflare/wrangler-action@v3
|
id: wrangler
|
||||||
with:
|
run: |
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
# Exécuter wrangler et rediriger la sortie vers un fichier tout en l'affichant (tee)
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
bunx wrangler ${{ steps.target.outputs.wrangler_command }} | tee wrangler.log
|
||||||
command: ${{ steps.target.outputs.wrangler_command }}
|
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
# Extraction de l'URL
|
||||||
|
if [ "${{ steps.target.outputs.env_name }}" = "Preview" ]; then
|
||||||
|
PREVIEW_URL=$(grep -o 'https://[^ ]*\.workers\.dev' wrangler.log | head -n 1)
|
||||||
|
echo "DEPLOY_URL=$PREVIEW_URL" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "DEPLOY_URL=https://arthurdanjou.fr" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
env:
|
env:
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
@@ -80,7 +86,8 @@ jobs:
|
|||||||
title: "Déploiement Portfolio (${{ steps.target.outputs.env_name }})"
|
title: "Déploiement Portfolio (${{ steps.target.outputs.env_name }})"
|
||||||
description: |
|
description: |
|
||||||
Build terminé sur la branche **${{ github.ref_name }}**.
|
Build terminé sur la branche **${{ github.ref_name }}**.
|
||||||
Environnement cible : **${{ steps.target.outputs.env_name }}**.
|
Environnement : **${{ steps.target.outputs.env_name }}**
|
||||||
|
URL : **${{ steps.wrangler.outputs.DEPLOY_URL }}**
|
||||||
Commit: `${{ github.sha }}` par ${{ github.actor }}.
|
Commit: `${{ github.sha }}` par ${{ github.actor }}.
|
||||||
nofail: false
|
nofail: false
|
||||||
nodetail: false
|
nodetail: false
|
||||||
|
|||||||
Reference in New Issue
Block a user