-
Notifications
You must be signed in to change notification settings - Fork 47
58 lines (51 loc) · 1.78 KB
/
deploy-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Test Deploy
on:
workflow_run:
workflows: ["Build & test"]
types: [completed]
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'elan-ev'
steps:
- name: Prepare deploy key
run: |
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.STUDIO_TEST_DEPLOY_KEY }}" | base64 -d > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Download artifacts from build workflow
uses: actions/download-artifact@4
with:
name: test-deployment-files
run-id: ${{ github.event.workflow_run.id }}
- name: Checkout test deployment repo
run: |
rm -rf studio-test || :
git clone "git@github.com:elan-ev/studio-test.git"
cd studio-test
git checkout gh-pages
- name: Prepare deployment files
run: |
deploydir=$(cat deploydir.tmp)
mkdir studio-test/${deploydir}
mv .github/.deploy-settings.toml studio-test/${deploydir}/settings.toml
mv build/* studio-test/${deploydir}/
rmdir build
- name: Build new index HTML
working-directory: studio-test
run: |
echo '<html><body><ul>' > index.html
find . -maxdepth 1 -name '20*' -type d \
| sort -r \
| sed 's/^\(.*\)$/<li><a href=\1>\1<\/a><\/li>/' >> index.html
echo '</ul></body></html>' >> index.html
- name: Commit and push
working-directory: studio-test
run: |
git add .
git config --global user.name 'GitHub Actions'
git config --global user.email 'noreply@github.com'
git commit -m "Deploy ${{ github.event.workflow_run.head_sha }} ($(date))"
git push origin gh-pages