Add Github Action workflow for website deployment
This commit is contained in:
parent
e2f97cb5a1
commit
f333f82bc0
6
.github/workflows/ci-workflow.yml
vendored
6
.github/workflows/ci-workflow.yml
vendored
@ -1,6 +1,10 @@
|
|||||||
name: CI Workflow
|
name: CI Workflow
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
paths-ignore: ['website/**']
|
||||||
|
pull_request:
|
||||||
|
paths-ignore: ['website/**']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
|
53
.github/workflows/website.yml
vendored
Normal file
53
.github/workflows/website.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
name: Website
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths: ['website/**']
|
||||||
|
pull_request:
|
||||||
|
paths: ['website/**']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
checks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
- name: Test Build
|
||||||
|
run: |
|
||||||
|
cd website
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
publish:
|
||||||
|
if: github.repository_owner == 'premake' && github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
- name: Add key to allow access to repository
|
||||||
|
env:
|
||||||
|
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||||
|
echo "${{ secrets.WEBSITE_DEPLOY_KEY }}" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
cat <<EOT >> ~/.ssh/config
|
||||||
|
Host github.com
|
||||||
|
HostName github.com
|
||||||
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
EOT
|
||||||
|
- name: Release to premake.github.io
|
||||||
|
env:
|
||||||
|
USE_SSH: true
|
||||||
|
GIT_USER: git
|
||||||
|
DEPLOYMENT_BRANCH: master
|
||||||
|
run: |
|
||||||
|
git config --global user.email "actions@gihub.com"
|
||||||
|
git config --global user.name "gh-actions"
|
||||||
|
cd website
|
||||||
|
npm install
|
||||||
|
npx docusaurus deploy
|
@ -25,3 +25,17 @@ npm run-script build
|
|||||||
```
|
```
|
||||||
|
|
||||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||||
|
|
||||||
|
## GitHub Actions
|
||||||
|
|
||||||
|
* Every **push** and **pull request** that affects anything in `website/**` will trigger website build (to make sure that no errors like broken links were introduced)
|
||||||
|
* Every **push to the master branch** in this repo that affects anything in `website/**` will trigger website deployment. It means that the website will be built and pushed to the master branch of [premake.github.io](https://github.com/premake/premake.github.io).
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
Target repo for deployment is specified in `docusaurus.config.js`.
|
||||||
|
|
||||||
|
* `organizationName` is a GitHub account name: github.com/**premake**/premake.github.io
|
||||||
|
* `projectName` is a target repository: github.com/premake/**premake.github.io**
|
||||||
|
|
||||||
|
`docusaurus deploy` command is used to automatically build and push static files into [premake.github.io](https://github.com/premake/premake.github.io) repo.
|
@ -3,8 +3,8 @@ module.exports = {
|
|||||||
tagline: 'Powerfully simple build configuration',
|
tagline: 'Powerfully simple build configuration',
|
||||||
url: 'https://premake.github.io/',
|
url: 'https://premake.github.io/',
|
||||||
baseUrl: '/',
|
baseUrl: '/',
|
||||||
onBrokenLinks: 'warn', // FIXME: when docs are ready change it to 'throw'
|
onBrokenLinks: 'throw',
|
||||||
onBrokenMarkdownLinks: 'warn',
|
onBrokenMarkdownLinks: 'throw',
|
||||||
favicon: 'img/premake-logo.png', // FIXME: make actual favicon.ico file
|
favicon: 'img/premake-logo.png', // FIXME: make actual favicon.ico file
|
||||||
organizationName: 'premake',
|
organizationName: 'premake',
|
||||||
projectName: 'premake.github.io',
|
projectName: 'premake.github.io',
|
||||||
|
Loading…
Reference in New Issue
Block a user