Skip to content

Commit

Permalink
Merge pull request #121 from meshy/ci-cd
Browse files Browse the repository at this point in the history
Add workflow to deploy website on a cron job
  • Loading branch information
meshy committed Jun 6, 2022
2 parents 6c9e975 + 591fc0b commit 64c5d00
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Deploy

on:
# Scheduled tasks only run on the main branch.
schedule:
# Just while testing:
cron: '*/10 * * * *' # Every 10 minutes.
# Once it seems to work
# cron: '0 10 * * *' # Daily at 10AM UTC.
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Clone code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install build dependencies
run: |
python -m pip install -r requirements.txt
- name: Fetch latest packages data and build the website
run: |
make generate
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::386531310338:role/pythonwheels_deploy_from_github
aws-region: eu-west-1

- name: Deploy the built files
run: |
TIMESTAMP=$(date --iso-8601=seconds --utc)
echo $TIMESTAMP
aws s3 cp index.html s3://pythonwheelscom
aws s3 cp wheel.svg s3://pythonwheelscom
aws s3 cp results.json s3://pythonwheelscom/results/${TIMESTAMP}.json
aws s3 cp s3://pythonwheelscom/results/${TIMESTAMP}.json s3://pythonwheelscom/results.json

0 comments on commit 64c5d00

Please sign in to comment.