Skip to content

Commit 12f7b62

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

1 file changed

Lines changed: 51 additions & 6 deletions

File tree

.github/workflows/static.yml

Lines changed: 51 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,45 @@ 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: Create s3cmd config
78+
run: |
79+
echo "[default]" > /home/runner/.s3cfg
80+
echo "access_key = ${{ secrets.SCW_ACCESS_KEY }}" >> /home/runner/.s3cfg
81+
echo "secret_key = ${{ secrets.SCW_SECRET_KEY }}" >> /home/runner/.s3cfg
82+
echo "host_base = s3.fr-par.scw.cloud" >> /home/runner/.s3cfg
83+
echo "host_bucket = %(bucket)s.s3.fr-par.scw.cloud" >> /home/runner/.s3cfg
84+
echo "use_https = True" >> /home/runner/.s3cfg
85+
86+
- name: Debug files
87+
run: ls -la
88+
89+
- name: Sync build to S3
90+
run: |
91+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
92+
--delete-removed --exclude '*.css' --exclude '*.js' --force
93+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
94+
--mime-type=text/css --exclude '*' --include '*.css' --force
95+
s3cmd sync build/ s3://quantstack-site/ --acl-public \
96+
--mime-type=application/javascript --exclude '*' --include '*.js' --force
97+
98+
- name: Ensure public ACL
99+
run: s3cmd setacl s3://quantstack-site/ --acl-public --recursive

0 commit comments

Comments
 (0)