⬆️ Bump files with dotnet-file sync #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow to cross-post a jekyll site (or GitHub Pages) | |
# to another org/repo. | |
# Required secrets in repository consuming this workflow: | |
# - PAGES_ORGANIZATION: the target organization to publish | |
# pages to. | |
# - PAGES_ACCESS_TOKEN: a token that is valid in the target | |
# org/repo for pushing the resulting site | |
# - PAGES_REPOSITORY: optional repository name under the | |
# target organization. Defaults to source repo name. | |
name: pages | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- pages | |
- docs | |
env: | |
PAGES_ORGANIZATION: ${{ secrets.PAGES_ORGANIZATION }} | |
PAGES_REPOSITORY: ${{ secrets.PAGES_REPOSITORY }} | |
jobs: | |
gh-pages: | |
runs-on: ubuntu-latest | |
env: | |
PAGES_ORGANIZATION: ${{ secrets.PAGES_ORGANIZATION }} | |
PAGES_REPOSITORY: ${{ secrets.PAGES_REPOSITORY }} | |
PAGES_ACCESS_TOKEN: ${{ secrets.PAGES_ACCESS_TOKEN }} | |
steps: | |
- name: ✅ organization | |
if: env.PAGES_ORGANIZATION == '' | |
run: | | |
echo "::error title=PAGES_ORGANIZATION secret is required." | |
exit 1 | |
- name: ✅ token | |
if: env.PAGES_ACCESS_TOKEN == '' | |
run: | | |
echo "::error title=PAGES_ACCESS_TOKEN secret is required." | |
exit 1 | |
- name: 🤘 checkout | |
uses: actions/checkout@v2 | |
- name: ⚙ jekyll | |
run: | | |
sudo gem install bundler | |
sudo bundle install | |
- name: 🖉 default repo | |
if: env.PAGES_REPOSITORY == '' | |
run: echo "PAGES_REPOSITORY=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | |
- name: 🙏 build | |
run: bundle exec jekyll build -b ${{ env.PAGES_REPOSITORY }} | |
env: | |
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: ✓ commit | |
run: | | |
cd _site | |
git init | |
git add -A | |
git config --local user.email "[email protected]" | |
git config --local user.name "[email protected]" | |
git commit -m "Publish pages from ${GITHUB_REPOSITORY}@${GITHUB_SHA:0:9}" | |
- name: 🚀 push | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ env.PAGES_ACCESS_TOKEN }} | |
repository: ${{ env.PAGES_ORGANIZATION }}/${{ env.PAGES_REPOSITORY }} | |
branch: gh-pages | |
force: true | |
directory: ./_site |