Skip to content

Commit fc40b0e

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

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

.github/workflows/static.yml

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

0 commit comments

Comments
 (0)