CI Add deployment setup for pyodide-cdn2.iodide.io (#666)

This commit is contained in:
Roman Yurchak 2020-05-19 18:15:21 +02:00 committed by GitHub
parent f2c4d63c89
commit 9f9a6c3965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 11 deletions

View File

@ -143,6 +143,11 @@ jobs:
- checkout - checkout
- attach_workspace: - attach_workspace:
at: . at: .
- run:
name: Install requirements
command: |
apk add --no-cache --update python3
python3 -m pip install awscli
- run: - run:
name: Deploy Github Releases name: Deploy Github Releases
command: | command: |
@ -151,23 +156,30 @@ jobs:
popd popd
ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -delete "${CIRCLE_TAG}" ./pyodide-build-${CIRCLE_TAG}.tar.bz2 ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -delete "${CIRCLE_TAG}" ./pyodide-build-${CIRCLE_TAG}.tar.bz2
deploy-netlify: - run:
name: Deploy to pyodide-cdn2.iodide.io
command: |
aws s3 sync --delete build/ "s3://pyodide-cdn2.iodide.io/v${CIRCLE_TAG}/full/" --cache-control max-age=30758400 # 1 year
# update 301 redirect for the /latest/* route.
aws s3api put-bucket-website --cli-input-json file://.circleci/s3-website-config.json
deploy-s3:
docker: docker:
- image: circleci/node:latest - image: circleci/python:3.7.7
steps: steps:
- checkout - checkout
- attach_workspace: - attach_workspace:
at: . at: .
- run: - run:
name: Install netlify-cli name: Install requirements
command: | command: |
sudo npm install netlify-cli -g sudo apt-get install -y groff
python3 -m pip install awscli
- run: - run:
name: Deploy to netlify name: Deploy to pyodide-cdn2.iodide.io
command: | command: |
cp src/_headers build aws s3 sync --delete build/ "s3://pyodide-cdn2.iodide.io/dev/full/" --cache-control max-age=3600 # 1 hour
netlify deploy --prod --dir=build -m "Deployed from CircleCI"
workflows: workflows:
version: 2 version: 2
@ -203,12 +215,10 @@ workflows:
ignore: /.*/ ignore: /.*/
tags: tags:
only: /^\d+\.\d+\.\d+$/ only: /^\d+\.\d+\.\d+$/
- deploy-netlify: - deploy-s3:
requires: requires:
- test-firefox - test-firefox
- test-python - test-python
filters: filters:
branches: branches:
ignore: /.*/ only: master
tags:
only: /^\d+\.\d+\.\d+$/

View File

@ -0,0 +1,18 @@
{
"Bucket": "pyodide-cdn2.iodide.io",
"WebsiteConfiguration": {
"IndexDocument": {
"Suffix": "index.html"
},
"RoutingRules": [
{
"Condition": {
"KeyPrefixEquals": "latest/"
},
"Redirect": {
"ReplaceKeyPrefixWith": "v0.14.3/"
}
}
]
}
}