forked from ilot/ilot-io
ci: move to pages server
This commit is contained in:
parent
2f88882e0d
commit
aec1460de9
6 changed files with 18 additions and 48 deletions
|
@ -11,12 +11,11 @@ jobs:
|
|||
- name: Environment setup
|
||||
run: |
|
||||
apk add git nodejs jq coreutils curl tree gawk grep
|
||||
- name: Public repo pull
|
||||
- name: Pages repo pull
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.PAGES_TOKEN }}
|
||||
ref: public
|
||||
ref: pages
|
||||
- name: Render website
|
||||
run: |
|
||||
export GITHUB_PR_NAME=$(grep -l ${{ github.sha }} previews/*/git_sha.txt | awk -F '/' '{print $2}')
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'public'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: x86_64
|
||||
container: alpine:latest
|
||||
env:
|
||||
GIT_SSH_COMMAND: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
|
||||
steps:
|
||||
- name: Environment setup
|
||||
run: |
|
||||
apk add git nodejs openssh-client-common openssh-client-default
|
||||
- name: Start ssh-agent
|
||||
uses: actions/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.PAGES_PRIVKEY }}
|
||||
- name: Repo pull
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Website upload
|
||||
run: |
|
||||
git remote set-url origin ${{ vars.PAGES_TARGET }}
|
||||
git push -f
|
|
@ -11,28 +11,27 @@ jobs:
|
|||
steps:
|
||||
- name: Environment setup
|
||||
run: |
|
||||
apk add git ikiwiki po4a perl-yaml-tiny tree nodejs
|
||||
apk add git ikiwiki po4a perl-yaml-tiny tree nodejs imagemagick-perlmagick imagemagick imagemagick-jpeg findutils bash imagemagick-webp
|
||||
- name: Repo pull
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.PAGES_TOKEN }}
|
||||
- name: Public repo pull
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
- name: Pages repo pull
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: public
|
||||
ref: pages
|
||||
path: public
|
||||
token: ${{ secrets.PAGES_TOKEN }}
|
||||
- name: Render website
|
||||
run: ikiwiki --setup ikiwiki.setup
|
||||
- name: Website upload
|
||||
run: |
|
||||
rm -Rf public/.forgejo
|
||||
mkdir -p public/.forgejo/workflows
|
||||
cp .forgejo/workflows/deploy.yaml public/.forgejo/workflows/.
|
||||
cp .pages-domains public/.domains
|
||||
cp .pages-redirect public/_redirects
|
||||
git log -1 --pretty=%B > commit.txt
|
||||
cd public
|
||||
find -name 'index.html' -type 'l' -delete
|
||||
find -name 'index.fr.html' -exec bash -c 'ln -s "${0/.*\/}" "${0/.fr/}"' {} \;
|
||||
date > generated.txt
|
||||
# Note: the following account information will not work on GHES
|
||||
git config user.name "forgejo-actions[bot]"
|
||||
|
|
|
@ -10,20 +10,18 @@ jobs:
|
|||
steps:
|
||||
- name: Environment setup
|
||||
run: |
|
||||
apk add git ikiwiki po4a perl-yaml-tiny tree nodejs jq coreutils curl
|
||||
echo "GITHUB_PR_NAME=$(curl -Ls ${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${{ github.ref_name }} | jq .title | tr ' ' '-' | tr -d ':' | tr -d '"' | tr '[:upper:]' '[:lower:]' | tr '/' '-')" >> $GITHUB_ENV
|
||||
apk add git ikiwiki po4a perl-yaml-tiny tree nodejs jq coreutils curl imagemagick-perlmagick imagemagick imagemagick-jpeg findutils bash imagemagick-webp
|
||||
echo "GITHUB_PR_NAME=$(curl -Ls ${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${{ github.ref_name }} -H 'accept: application/json' -H 'Authorization: token ${{ secrets.FORGEJO_TOKEN }}' | jq .title | tr ' ' '-' | tr -d ':' | tr -d '"' | tr '[:upper:]' '[:lower:]' | tr '/' '-' | tr -d ',')" >> $GITHUB_ENV
|
||||
- name: Repo pull
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.PAGES_TOKEN }}
|
||||
- name: Public repo pull
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: public
|
||||
ref: pages
|
||||
path: public
|
||||
token: ${{ secrets.PAGES_TOKEN }}
|
||||
- name: Render website
|
||||
run: |
|
||||
rm -rf public/previews/$GITHUB_PR_NAME || true
|
||||
|
@ -32,11 +30,11 @@ jobs:
|
|||
ikiwiki --setup ikiwiki.setup
|
||||
cd public/previews
|
||||
tree -d -H '.' -L 1 --noreport --charset utf-8 -T "Versions" -o index.html
|
||||
cd $GITHUB_PR_NAME
|
||||
find -name 'index.html' -type 'l' -delete
|
||||
find -name 'index.fr.html' -exec bash -c 'ln -s "${0/.*\/}" "${0/.fr/}"' {} \;
|
||||
- name: Website upload
|
||||
run: |
|
||||
rm -Rf public/.forgejo
|
||||
mkdir -p public/.forgejo/workflows
|
||||
cp .forgejo/workflows/deploy.yaml public/.forgejo/workflows/.
|
||||
git log -1 --pretty=%B > commit.txt
|
||||
cd public
|
||||
date > previews/$GITHUB_PR_NAME/generated.txt
|
||||
|
|
1
.pages-domains
Normal file
1
.pages-domains
Normal file
|
@ -0,0 +1 @@
|
|||
www.ilot.io
|
0
.pages-redirect
Normal file
0
.pages-redirect
Normal file
Loading…
Add table
Reference in a new issue