Skip to content

Commit 902b507

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

File tree

1 file changed

+59
-6
lines changed

1 file changed

+59
-6
lines changed

.github/workflows/static.yml

Lines changed: 59 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,53 @@ 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 secret
82+
run: |
83+
if [ -z "${{ secrets.SCW_ACCESS_KEY }}" ]; then
84+
echo "Secret SCW_ACCESS_KEY is not set"
85+
exit 1
86+
fi
87+
88+
- name: Create s3cmd config
89+
run: |
90+
echo "[default]" > /home/runner/.s3cfg
91+
echo "access_key = ${{ secrets.SCW_ACCESS_KEY }}" >> /home/runner/.s3cfg
92+
echo "secret_key = ${{ secrets.SCW_SECRET_KEY }}" >> /home/runner/.s3cfg
93+
echo "host_base = s3.fr-par.scw.cloud" >> /home/runner/.s3cfg
94+
echo "host_bucket = %(bucket)s.s3.fr-par.scw.cloud" >> /home/runner/.s3cfg
95+
echo "use_https = True" >> /home/runner/.s3cfg
96+
97+
- name: Sync build to S3
98+
run: |
99+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
100+
--delete-removed --exclude '*.css' --exclude '*.js' --force
101+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
102+
--mime-type=text/css --exclude '*' --include '*.css' --force
103+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
104+
--mime-type=application/javascript --exclude '*' --include '*.js' --force
105+
106+
- name: Ensure public ACL
107+
run: s3cmd setacl s3://quantstack-site/ --acl-public --recursive

0 commit comments

Comments
 (0)