1+ # Workflow to cross-post a jekyll site (or GitHub Pages)
2+ # to another org/repo.
3+ # Required secrets in repository consuming this workflow:
4+ # - PAGES_ORGANIZATION: the target organization to publish
5+ # pages to.
6+ # - PAGES_ACCESS_TOKEN: a token that is valid in the target
7+ # org/repo for pushing the resulting site
8+ # - PAGES_REPOSITORY: optional repository name under the
9+ # target organization. Defaults to source repo name.
10+
111name : pages
212on :
313 workflow_dispatch :
414 push :
515 branches :
616 - main
717 - pages
18+ - docs
819
920env :
1021 PAGES_ORGANIZATION : ${{ secrets.PAGES_ORGANIZATION }}
1324jobs :
1425 gh-pages :
1526 runs-on : ubuntu-latest
27+ env :
28+ PAGES_ORGANIZATION : ${{ secrets.PAGES_ORGANIZATION }}
29+ PAGES_REPOSITORY : ${{ secrets.PAGES_REPOSITORY }}
30+ PAGES_ACCESS_TOKEN : ${{ secrets.PAGES_ACCESS_TOKEN }}
1631 steps :
32+ - name : ✅ organization
33+ if : env.PAGES_ORGANIZATION == ''
34+ run : |
35+ echo "::error title=PAGES_ORGANIZATION secret is required."
36+ exit 1
37+
38+ - name : ✅ token
39+ if : env.PAGES_ACCESS_TOKEN == ''
40+ run : |
41+ echo "::error title=PAGES_ACCESS_TOKEN secret is required."
42+ exit 1
43+
1744 - name : 🤘 checkout
1845 uses : actions/checkout@v2
1946
2249 sudo gem install bundler
2350 bundle install
2451
25- - name : 🖉 default env
26- env :
27- PAGES_ORGANIZATION : ${{ secrets.PAGES_ORGANIZATION }}
28- PAGES_REPOSITORY : ${{ secrets.PAGES_REPOSITORY }}
29- run : |
30- echo "PAGES_ORGANIZATION=${PAGES_ORGANIZATION}" >> $GITHUB_ENV
31- echo "PAGES_REPOSITORY=${PAGES_REPOSITORY}" >> $GITHUB_ENV
32-
3352 - name : 🖉 default repo
3453 if : env.PAGES_REPOSITORY == ''
3554 run : echo "PAGES_REPOSITORY=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
@@ -44,14 +63,14 @@ jobs:
4463 cd _site
4564 git init
4665 git add -A
47- git config --local user.email "bot@devlooped.com "
48- git config --local user.name "bot@devlooped.com "
66+ git config --local user.email "bot@clarius.org "
67+ git config --local user.name "bot@clarius.org "
4968 git commit -m "Publish pages from ${GITHUB_REPOSITORY}@${GITHUB_SHA:0:9}"
5069
5170 - name : 🚀 push
5271 uses : ad-m/github-push-action@v0.6.0
5372 with :
54- github_token : ${{ secrets .PAGES_ACCESS_TOKEN }}
73+ github_token : ${{ env .PAGES_ACCESS_TOKEN }}
5574 repository : ${{ env.PAGES_ORGANIZATION }}/${{ env.PAGES_REPOSITORY }}
5675 branch : gh-pages
5776 force : true
0 commit comments