From 039dcd394269a2027310870a044a4d5ea26055e3 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 22 Mar 2024 22:03:47 +0100 Subject: [PATCH] Switch to branch-less GitHub pages workflow --- .github/workflows/main.yml | 61 +++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 08eea3f..fdc1e0e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,43 +1,42 @@ name: Build + on: push: branches: - main + jobs: deploy: name: Build and deploy the site runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + steps: - - name: Check out the repository - env: - REPOSITORY: ${{ github.repository }} - run: | - ls -la - git clone "https://github.com/$REPOSITORY" . - - name: Download Zola - run: | - version='v0.18.0' - archive="zola-${version}-x86_64-unknown-linux-gnu.tar.gz" - curl -L "https://github.com/getzola/zola/releases/download/${version}/${archive}" -o "$archive" - tar xf "$archive" - - name: Build the site - run: | - ./zola build - - name: Deploy the site - working-directory: ./public - env: - DEPLOY_SECRET_KEY: ${{ secrets.DEPLOY_SECRET_KEY }} - run: | - mkdir ~/.ssh - echo "$DEPLOY_SECRET_KEY" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 + - name: Check out the repository + env: + REPOSITORY: ${{ github.repository }} + run: | + ls -la + git clone "https://github.com/$REPOSITORY" . + + - name: Download Zola + run: | + version='v0.18.0' + archive="zola-${version}-x86_64-unknown-linux-gnu.tar.gz" + curl -L "https://github.com/getzola/zola/releases/download/${version}/${archive}" -o "$archive" + tar xf "$archive" + + - name: Build the site + run: | + ./zola build - echo 'Host *' >> ~/.ssh/config - echo ' StrictHostKeyChecking=no' >> ~/.ssh/config + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v1 + with: + path: public - git config --global user.email "noreply@ruma.dev" - git config --global user.name "CI" - git init -b built - git add -A - git commit -m "Add files generated by zola" - git push -f git@github.com:ruma/ruma.dev built + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v2