Skip to content

Commit 8137518

Browse files
Update main.yml
1 parent 525f128 commit 8137518

File tree

1 file changed

+20
-31
lines changed

1 file changed

+20
-31
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ on:
2121
paths-ignore:
2222
- README.md
2323

24+
permissions:
25+
contents: read
26+
pages: write
27+
id-token: write
28+
29+
concurrency:
30+
group: "pages"
31+
cancel-in-progress: false
32+
2433
jobs:
2534
build:
2635
strategy:
@@ -56,39 +65,19 @@ jobs:
5665
name: site
5766
path: site.zip
5867

68+
- name: Upload artifact
69+
uses: actions/upload-pages-artifact@v3
70+
with:
71+
path: ./site
72+
5973
publish:
6074
if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_artifacts == 'Y')
6175
needs: build
6276
runs-on: ubuntu-latest
63-
77+
environment:
78+
name: github-pages
79+
url: ${{ steps.deployment.outputs.page_url }}
6480
steps:
65-
- name: Checkout repository
66-
uses: actions/checkout@v4
67-
with:
68-
ref: gh-pages
69-
path: neoteroi
70-
71-
- name: Download artifact
72-
uses: actions/download-artifact@v4
73-
with:
74-
name: site
75-
path: site
76-
77-
- name: Unzip artifact
78-
run: |
79-
unzip site/site.zip -d site
80-
81-
- name: Deploy to gh-pages branch
82-
run: |
83-
find neoteroi -mindepth 1 ! -name '.git' ! -name 'CNAME' ! -name 'README.md' ! -path 'neoteroi/.git/*' -exec rm -rf {} +
84-
cp -r site/site/* neoteroi/
85-
86-
cd neoteroi
87-
git config user.name "${GITHUB_ACTOR}"
88-
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
89-
90-
git add .
91-
git commit -m "Deploy documentation on $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
92-
93-
git push origin gh-pages
94-
echo "Published to gh-pages"
81+
- name: Deploy to GitHub Pages
82+
id: deployment
83+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)