Skip to content

Commit

Permalink
migrating over diff.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Robpol86 committed Oct 8, 2023
1 parent 5a8cf2b commit 081e417
Showing 1 changed file with 17 additions and 30 deletions.
47 changes: 17 additions & 30 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,38 @@ env:
jobs:

Build:
if: github.event.action != 'closed' || (github.event.pull_request.merged && github.event.pull_request.base.ref == 'main')
uses: ./.github/workflows/build.yml
with:
prettyfy: true
skip_lints_tests: true
sphinx_github_branch: main
sphinx_html_baseurl: https://rob86stage.robpol86.com/

Commit:
if: github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
needs: Build
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Initialize Python and Poetry
uses: ./.github/actions/init
- name: Download HTML
uses: actions/download-artifact@v3
with:
python-version: "3.10"
- name: Build docs
env:
SPHINX_GITHUB_BRANCH: main
SPHINX_HTML_BASEURL: "https://rob86stage.robpol86.com/"
run: make docs
name: html
path: html
- name: Create .gitignore
env:
GIT_IGNORE: |
.doctrees/
__pycache__/
run: printenv GIT_IGNORE |tee -a "$ROOT_DIR_DIFF/.gitignore"
- name: Prettify
run: |
PS4="\n\033[1;33m$PS4\033[0m"
set -euxo pipefail
npm install -g prettier@2.8.8 @prettier/plugin-xml@2.2.0
prettier --write "$ROOT_DIR_DIFF/**/*.{js,css,html,xml}"
- name: Store HTML as temporary artifact
if: github.event.action != 'closed'
uses: actions/upload-artifact@v3
with:
name: html_new
if-no-files-found: error
path: "${{ env.ROOT_DIR_DIFF }}"
run: printenv GIT_IGNORE |tee -a html/.gitignore
- name: Store HTML in orphaned branch
if: github.event.pull_request.merged && github.event.pull_request.base.ref == 'main'
uses: peaceiris/actions-gh-pages@v3
with:
commit_message: "[skip ci]"
enable_jekyll: true # Don't create .nojekyll
force_orphan: true # Discard git history
github_token: "${{ secrets.GITHUB_TOKEN }}"
publish_branch: "${{ env.BRANCH_NAME_HTML_OLD }}"
publish_dir: "${{ env.ROOT_DIR_DIFF }}"
publish_dir: html

Diff:
if: github.event.action != 'closed'
Expand All @@ -84,7 +71,7 @@ jobs:
- name: Fetch new HTML
uses: actions/download-artifact@v3
with:
name: html_new
name: html
path: html
- name: Git Status
id: git_status
Expand Down

0 comments on commit 081e417

Please sign in to comment.