Skip to content

Commit

Permalink
Added automatic deployment with Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
hariesramdhani committed Jul 3, 2024
1 parent 0a106f2 commit 2471fc3
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 9 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4


26 changes: 26 additions & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test deployment

on:
pull_request:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci
- name: Test build website
run: npm run build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Contributing is very easy even when you have limited programming knowledge!
```bash
git clone https://github.com/MorganResearchLab/wiki.git
```
2. All of the posts are located in the `docs` folder, creating new folder inside of it will create a new category in the sidebar. Creating an `.md` or React component (`.jsx`) will create a new post. More on [Docusaurus guides](https://docusaurus.io/docs/category/guides)
2. All of the posts are located in the `docs` folder, creating new folder inside of it will create a new category in the sidebar. Creating a markdown file (`.md`, `.mdx`) or React component (`.jsx`) will create a new post. More on [Docusaurus guides](https://docusaurus.io/docs/category/guides)
3. To preview how the wiki looks like after you add something to the `docs` folder. You have to make sure you have Node.js and Node Package Manager installed, otherwise you can skip step 3 and 4
```
npm run dev
Expand Down
12 changes: 4 additions & 8 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ Contributing is very easy even when you have limited programming knowledge!
```bash
git clone https://github.com/MorganResearchLab/wiki.git
```
2. All of the posts are located in the `docs` folder, creating new folder inside of it will create a new category in the sidebar. Creating an `.md` or React component (`.jsx`) will create a new post. More on [Docusaurus guides](https://docusaurus.io/docs/category/guides)
3. To preview how the wiki looks like after you add something to the `docs` folder. You have to make sure you have Node.js and Node Package Manager installed, otherwise you can skip step 3 and 4
1. All of the posts are located in the `docs` folder, creating new folder inside of it will create a new category in the sidebar. Creating an `.md` or React component (`.jsx`) will create a new post. More on [Docusaurus guides](https://docusaurus.io/docs/category/guides)
1. To preview how the wiki looks like after you add something to the `docs` folder. You have to make sure you have Node.js and Node Package Manager installed, otherwise you can skip step 3 and 4
```
npm run dev
```
4. If you're happy with how it looks like, you can generate the github page for the deployment
```
GIT_USER=<GITHUB_USERNAME> npm run deploy
```
5. Add, commit and push all changes
1. Add, commit and push all changes
```
git add .
git commit -m "<INSERT_YOUR_MESSAGE_HERE>"
git push
```
6. It's live now on [MorganLab Wiki](https://morganresearchlab.github.io/Wiki/) (if you do step 3 and 4, otherwise wait for Haries to generate it for you), thanks for contributing!
1. Wait the GitHub action to finish and it's live now on [MorganLab Wiki](https://morganresearchlab.github.io/Wiki/) thanks for contributing!

0 comments on commit 2471fc3

Please sign in to comment.