Skip to content

Commit 0af77a9

Browse files
committed
add deployment on s3 scaleway
1 parent 0f7e2f2 commit 0af77a9

File tree

1 file changed

+64
-6
lines changed

1 file changed

+64
-6
lines changed

.github/workflows/static.yml

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# Simple workflow for deploying static content to GitHub Pages
22
name: Deploy static content to Pages
33

4+
# on:
5+
# # Runs on pushes targeting the default branch
6+
# push:
7+
# branches: ["master"]
8+
# pull_request:
9+
# branches:
10+
# - '*'
411
on:
5-
# Runs on pushes targeting the default branch
612
push:
7-
branches: ["master"]
8-
pull_request:
913
branches:
10-
- '*'
14+
- '**'
1115

1216
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1317

@@ -31,7 +35,7 @@ jobs:
3135
- name: Install the dependencies
3236
run: npm ci
3337
- name: Build
34-
run: npm run build
38+
run: npm run build
3539
- name: Upload artifact
3640
uses: actions/upload-pages-artifact@v3
3741
with:
@@ -51,4 +55,58 @@ jobs:
5155
steps:
5256
- name: Deploy to GitHub Pages
5357
id: deployment
54-
uses: actions/deploy-pages@v4
58+
uses: actions/deploy-pages@v4
59+
60+
deploy-s3:
61+
needs: build
62+
# if: github.ref == 'refs/heads/master'
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
68+
- name: Install s3cmd
69+
run: sudo apt-get update && sudo apt-get install -y s3cmd
70+
71+
- name: Download build artifact
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: github-pages
75+
path: build
76+
77+
- name: Extract artifact
78+
run: |
79+
tar -xf build/artifact.tar -C build
80+
81+
- name: Check files
82+
run: |
83+
ls
84+
ls build
85+
86+
- name: Check secret
87+
run: |
88+
if [ -z "${{ secrets.SCW_ACCESS_KEY }}" ]; then
89+
echo "Secret SCW_ACCESS_KEY is not set"
90+
exit 1
91+
fi
92+
93+
- name: Create s3cmd config
94+
run: |
95+
echo "[default]" > /home/runner/.s3cfg
96+
echo "access_key = ${{ secrets.SCW_ACCESS_KEY }}" >> /home/runner/.s3cfg
97+
echo "secret_key = ${{ secrets.SCW_SECRET_KEY }}" >> /home/runner/.s3cfg
98+
echo "host_base = s3.fr-par.scw.cloud" >> /home/runner/.s3cfg
99+
echo "host_bucket = %(bucket)s.s3.fr-par.scw.cloud" >> /home/runner/.s3cfg
100+
echo "use_https = True" >> /home/runner/.s3cfg
101+
102+
- name: Sync build to S3
103+
run: |
104+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
105+
--delete-removed --exclude '*.css' --exclude '*.js' --force
106+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
107+
--mime-type=text/css --exclude '*' --include '*.css' --force
108+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
109+
--mime-type=application/javascript --exclude '*' --include '*.js' --force
110+
111+
- name: Ensure public ACL
112+
run: s3cmd setacl s3://quantstack-site/ --acl-public --recursive

0 commit comments

Comments
 (0)