diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index ea9052e8..c61a2a26 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -1,6 +1,10 @@ name: CI Workflow -on: [push, pull_request] +on: + push: + paths-ignore: ['website/**'] + pull_request: + paths-ignore: ['website/**'] jobs: linux: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 00000000..7cbc67f0 --- /dev/null +++ b/.github/workflows/website.yml @@ -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 <> ~/.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 diff --git a/website/README.md b/website/README.md index 5cdfc828..845e9e22 100644 --- a/website/README.md +++ b/website/README.md @@ -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. + +## 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. \ No newline at end of file diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 96a3ee70..e8b0f3c8 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -3,8 +3,8 @@ module.exports = { tagline: 'Powerfully simple build configuration', url: 'https://premake.github.io/', baseUrl: '/', - onBrokenLinks: 'warn', // FIXME: when docs are ready change it to 'throw' - onBrokenMarkdownLinks: 'warn', + onBrokenLinks: 'throw', + onBrokenMarkdownLinks: 'throw', favicon: 'img/premake-logo.png', // FIXME: make actual favicon.ico file organizationName: 'premake', projectName: 'premake.github.io',