Skip to content

Commit

Permalink
Migrate to actions-mn/deploy-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed Nov 18, 2023
1 parent 4e6115b commit 5f88e51
Showing 1 changed file with 10 additions and 45 deletions.
55 changes: 10 additions & 45 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,79 +23,44 @@ concurrency:
cancel-in-progress: true

permissions:
pull-requests: write
id-token: write
contents: read
pages: write
id-token: write
pull-requests: write

jobs:
build:
if: ${{ github.event.action != 'closed' }}
runs-on: ubuntu-latest
container:
image: metanorma/metanorma # ${{ inputs.docker-image }}
image: metanorma/metanorma
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.pat_token || github.token }}
submodules: true

- name: Metanorma generate site
uses: actions-mn/build-and-publish@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
destination: artifact
agree-to-terms: true

deploy-gh-pages:
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} # inputs.deploy-gh-pages == 'true' &&
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Deploy to GitHub Pages
uses: actions-mn/deploy-pages@main
with:
token: ${{ secrets.pat_token || github.token }}
- uses: actions/download-artifact@v3
with:
name: github-pages
path: site
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site
branch: gh-pages
clean-exclude: pr-preview
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}

deploy-gh-pages-preview:
if: ${{ github.event_name == 'pull_request' }} # inputs.deploy-gh-pages == 'true' &&
clean-gh-pages:
if: ${{ github.event.action == 'closed' }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.pat_token || github.token }}
- uses: actions/download-artifact@v3
with:
name: github-pages
path: site
- uses: rossjrw/pr-preview-action@v1
with:
source-dir: site
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}

deploy-gh-pages-cleanup:
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }} # inputs.deploy-gh-pages == 'true' &&
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.pat_token || github.token }}
- uses: rossjrw/pr-preview-action@v1
- name: Deploy to GitHub Pages
uses: actions-mn/deploy-pages@main
with:
source-dir: .
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}

0 comments on commit 5f88e51

Please sign in to comment.