From 2327697d1bb87b9f7d89e042b0f0a2c83d046b12 Mon Sep 17 00:00:00 2001 From: Michal Stanke Date: Sat, 6 Apr 2024 12:26:38 +0200 Subject: [PATCH] ci: publish pages using Github Actions --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ .github/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + .nojekyll | 0 CNAME | 1 - 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .gitignore delete mode 100644 .nojekyll delete mode 100644 CNAME diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f666f44 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: # allows to be run manually + workflow_call: # when called from another workflow + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Build site + run: | + mkdir -p _site + find . -maxdepth 1 -mindepth 1 -not -name _site -not -name '*.md' -not -name LICENSE -not -name .github -not -name .gitignore -not -name .git -exec cp -r '{}' _site \; + - name: Save built site for deploy + uses: actions/upload-pages-artifact@v3 + with: + path: _site + retention-days: 7 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c1c000c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - master + workflow_dispatch: # allows to be run manually + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + uses: ./.github/workflows/build.yml + deploy: + if: github.ref == 'refs/heads/master' + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - id: deployment + name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca35be0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +_site diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29..0000000 diff --git a/CNAME b/CNAME deleted file mode 100644 index bef7732..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -www.firefox.cz