Skip to content

Commit 036893a

Browse files
committed
fix : dartdoc deployment job github-pages
1 parent 232d448 commit 036893a

File tree

1 file changed

+35
-21
lines changed

1 file changed

+35
-21
lines changed

.github/workflows/dartdoc-gh-pages.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
1-
# Sample workflow for building and deploying a Dartdoc site to GitHub Pages
21
name: Deploy Dartdoc with GitHub Pages dependencies preinstalled
32

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
75
branches:
8-
- main
9-
- develop
10-
- 13-distribute-demo-app-for-validation
6+
- main
7+
- develop
8+
- 13-distribute-demo-app-for-validation
9+
1110

12-
# Allows you to run this workflow manually from the Actions tab
1311
workflow_dispatch:
1412

15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1613
permissions:
17-
contents: read
14+
contents: write
1815
pages: write
1916
id-token: write
2017

21-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2318
concurrency:
2419
group: "pages"
2520
cancel-in-progress: false
2621

2722
jobs:
28-
# Build job
2923
build:
3024
runs-on: ubuntu-latest
3125
steps:
@@ -58,19 +52,39 @@ jobs:
5852
uses: actions/upload-pages-artifact@v3
5953
with:
6054
path: ./docs
61-
name: github-pages
6255

63-
# Deployment job
6456
deploy:
65-
environment:
66-
name: github-pages
67-
url: ${{ steps.deployment.outputs.page_url }}
6857
runs-on: ubuntu-latest
6958
needs: build
7059
steps:
71-
- name: Deploy to GitHub Pages
72-
id: deployment
73-
uses: actions/deploy-pages@v3
60+
- name: Checkout repository
61+
uses: actions/checkout@v2
62+
63+
- name: Download artifact
64+
uses: actions/download-artifact@v4
7465
with:
75-
token: ${{ secrets.GITHUB_TOKEN }}
76-
artifact_name: github-pages
66+
name: github-pages
67+
68+
- name: List files in current directory (to verify artifact)
69+
run: |
70+
ls -la
71+
72+
- name: Create docs directory if not exists
73+
run: |
74+
mkdir -p ./docs # S'assure que le dossier docs existe
75+
76+
- name: List files in docs folder
77+
run: ls -la ./docs # Vérifier que les fichiers sont bien extraits
78+
79+
- name: Commit changes and push to gh-pages
80+
run: |
81+
git config --global user.name "GitHub Actions"
82+
git config --global user.email "actions@github.com"
83+
git checkout gh-pages || git checkout -b gh-pages
84+
find . -type f ! -name 'CNAME' -exec git rm -f {} +
85+
git add ./docs/*
86+
git commit -m "doc: deploy site to GitHub Pages" || echo "No changes to commit"
87+
git push origin gh-pages --force
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+

0 commit comments

Comments
 (0)