From 80616424ca669ef79ef9bd5e9330125413858561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Fri, 6 Aug 2021 10:58:24 +0200 Subject: [PATCH] Add GitHub action to automatically build and deploy website --- .github/workflows/ci.yml | 18 ++++++++++++++++++ README.md | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6ba230d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: Deploy + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + Deploy: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - run: mkdir -p ~/.ssh && echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa && chmod 400 ~/.ssh/id_rsa + - run: git config --global user.name "GitHub Actions" && git config --global user.email "actions@github.com" + - run: make + - run: git config --global url."https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + - run: make deploy + if: ${{ github.ref == 'refs/heads/main' }} diff --git a/README.md b/README.md index a88604d..dcc94c5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Framework X website +[![CI status](https://github.com/clue/framework-xwebsite/workflows/Deploy/badge.svg)](https://github.com/clue/framework-x-website/actions) + Source code for the Framework X website. ## Build @@ -37,3 +39,18 @@ the `live` branch like this: ```bash $ make deploy ``` + +## Auto-Deployment + +The website can be automatically deployed via the GitHub Pages feature. + +Any time a commit is merged (such as when a PR is merged), GitHub actions will +automatically build and deploy the website. This is done by running the above +deployment script (see previous chapter). + +> Repository setup: +> Note that this command will clone Framework X which is currently in early access. +> We're using a read-only SSH deploy key for reading from this source repository. +> Make sure the required `DEPLOY_KEY` secret is set in the repository settings on GitHub. +> See [action documentation](https://github.com/JamesIves/github-pages-deploy-action#using-an-ssh-deploy-key-) +> for more details.