-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to branch-less GitHub pages workflow
- Loading branch information
Showing
1 changed file
with
30 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "[email protected]" | ||
git config --global user.name "CI" | ||
git init -b built | ||
git add -A | ||
git commit -m "Add files generated by zola" | ||
git push -f [email protected]:ruma/ruma.dev built | ||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v2 |