Created
March 16, 2022 19:15
-
-
Save CypherpunkSamurai/85f6214d579a6fa61bc66a4a45c3c3ec to your computer and use it in GitHub Desktop.
Github Actions CI
This file contains hidden or 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
| name: Github Pages | |
| on: | |
| push: | |
| branches: | |
| - master # Here source code branch is `master`, it could be other branch | |
| jobs: | |
| build_and_deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π³ Checkout Repo | |
| uses: actions/checkout@v2 | |
| # Use GitHub Actions' cache to cache dependencies on servers | |
| - name: π¦ Cache Dependencies | |
| uses: actions/cache@v1 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gems- | |
| # Use GitHub Actions' cache to cache dependencies on servers | |
| - name: π₯ Install ruby | |
| uses: actions/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.0 | |
| - name: π Jekyll publish | |
| env: | |
| JEKYLL_DESTINATION: gh-pages | |
| run: | | |
| #sudo apt-get -yqq install libpq-dev | |
| #gem install bundle | |
| bundle install --path=vendor/bundle --jobs 4 | |
| bundle clean | |
| JEKYLL_ENV=production bundle exec jekyll build --destination $JEKYLL_DESTINATION | |
| - name: π€ Push to Repo | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }} | |
| GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} | |
| JEKYLL_DESTINATION: gh-pages | |
| run: | | |
| git config --global user.name "Github Actions" | |
| git config --global user.email "test@github.com" | |
| git add "$JEKYLL_DESTINATION" && git commit -m "Github Pages Publish" | |
| git subtree split --prefix "$JEKYLL_DESTINATION" -b gh-pages | |
| git push -f origin gh-pages:gh-pages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment