Skip to content

Commit cc0d133

Browse files
authored
ci: switch to "deploy-page" action and stop relying on additional branches (#488)
1 parent 310078e commit cc0d133

File tree

1 file changed

+22
-32
lines changed

1 file changed

+22
-32
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ on:
1616
schedule:
1717
- cron: '42 16 1/7 * *'
1818

19+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
20+
permissions:
21+
contents: read
22+
pages: write
23+
id-token: write
24+
25+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
26+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
27+
concurrency:
28+
group: "pages"
29+
cancel-in-progress: false
30+
1931
env:
2032
MDBOOK_LINKCHECK_VER: 0.7.6
2133

@@ -62,43 +74,21 @@ jobs:
6274
run: |
6375
mdbook build
6476
65-
- name: Store final build
66-
uses: actions/upload-artifact@v2
77+
- name: Upload artifact
78+
uses: actions/upload-pages-artifact@v1
6779
with:
68-
name: Build output
6980
path: pandocs/docs/pandocs/
70-
if-no-files-found: error
7181

7282
deploy:
7383
name: Deploy to GitHub pages
84+
# Do not run this unless *pushing* to `master`.
85+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
86+
environment:
87+
name: github-pages
88+
url: ${{ steps.deployment.outputs.page_url }}
7489
runs-on: ubuntu-latest
7590
needs: build
76-
# Do not run this unless *pushing* to `master`
77-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
7891
steps:
79-
- name: Checkout pandocs/gh-pages
80-
uses: actions/checkout@v2
81-
with:
82-
path: pandocs
83-
ref: gh-pages
84-
85-
- name: Delete all current files
86-
run: |
87-
rm -vrf pandocs/*
88-
89-
- name: Unpack build
90-
uses: actions/download-artifact@v2
91-
with:
92-
name: Build output
93-
path: pandocs/
94-
95-
- name: Deploy
96-
working-directory: pandocs/
97-
run: |
98-
git config --local user.name "GitHub Action"
99-
git config --global user.email "[email protected]"
100-
git remote -v
101-
git branch -v
102-
git add -A
103-
git commit -am 'Update build'
104-
git push -v
92+
- name: Deploy to GitHub Pages
93+
id: deployment
94+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)