Skip to content

Commit

Permalink
Simplify CI (#2)
Browse files Browse the repository at this point in the history
* Set up docs preview with 'mo-doc'

* Simplify formatter CI

* Add 'docs' npm script

* Update CI

* Fix

* Run 'dfx cache install'

* Update github.io domain

* Add 'destination_dir'

* Fix

* Adjust preview message text

* Fix

* Update CI

* Swap out GH Pages deploy action

* Fix

* Simplify formatter CI

* Use Node 20.x

* Fix version conflict in package.json

* Misc

* Clarify preview text

* Simplify CI

* Merge

* Try 'source code' in parentheses

* More adjustments

* More adjustments

* Misc

* Eh

* Ehh
  • Loading branch information
rvanasa authored Nov 27, 2024
1 parent d639538 commit 913d04d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
id: deploy-preview
message: "⏳ Loading documentation preview..."

- name: Set domain
run: echo "DOMAIN=dfinity.github.io" >> $GITHUB_ENV

- name: Checkout website repo
uses: actions/checkout@v2

Expand All @@ -42,9 +39,6 @@ jobs:

- run: dfx cache install

- name: Set production base URL
run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/" >> $GITHUB_ENV

- name: Build docs if main branch
if: github.ref == 'refs/heads/main'
run: npm run docs
Expand All @@ -56,10 +50,6 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
folder: ./docs

- name: Set base URL for preview if PR
if: github.ref != 'refs/heads/main'
run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV

- name: Build PR preview website
if: github.ref != 'refs/heads/main'
run: npm run docs
Expand All @@ -80,4 +70,4 @@ jobs:
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "✨ Documentation preview for ${{ github.event.after }}:\n\n> **${{ env.BASE_URL }}**\n\n[Source code](https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/)"
message: "✨ Documentation preview for ${{ github.event.after }}:\n\n> **https://dfinity.github.io/${{ github.event.repository.name }}/${{ env.PR_PATH}}** ([source code](https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/))"
15 changes: 7 additions & 8 deletions .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Delete preview on PR close
name: Delete preview on PR closed

# only trigger on pull request closed events
on:
pull_request:
types: [closed]
Expand All @@ -12,14 +11,14 @@ jobs:
PR_PATH: pull/${{github.event.number}}
steps:
- name: Make empty dir
run: mkdir public
run: mkdir docs

- name: Delete folder
uses: peaceiris/actions-gh-pages@v3
uses: JamesIves/github-pages-deploy-action@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: ${{ env.PR_PATH }}
token: ${{ secrets.GITHUB_TOKEN }}
folder: ./docs
target-folder: ${{ env.PR_PATH }}

- name: Comment on PR
uses: hasura/[email protected]
Expand All @@ -28,4 +27,4 @@ jobs:
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "PR closed. Deleted preview at https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/"
message: null
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Motoko Base Library Redesign
# Motoko Base Library Revamp

##### [Documentation preview](https://dfinity.github.io/motoko-base-revamp)

---

0 comments on commit 913d04d

Please sign in to comment.