Data Pipeline #758
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Data Pipeline | |
on: | |
schedule: | |
- cron: "0 9 * * *" | |
workflow_dispatch: | |
jobs: | |
data_pipeline: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Do this now to avoid downloading while the VPN is on | |
- name: Download Relevant Image | |
run: cicd/etl.sh sleep 0 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-2 | |
- name: Install OpenVPN | |
run: sudo apt-get --yes install --no-install-recommends openvpn | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
- name: Connect to ProtonVPN | |
run: vpn/connect.sh vpn/config.ovpn | |
env: | |
VPN_USERNAME: ${{ secrets.PROTONVPN_USERNAME }} | |
VPN_PASSWORD: ${{ secrets.PROTONVPN_PASSWORD }} | |
VPN_ROOT_CERT: ${{ secrets.PROTONVPN_ROOT_CERT }} | |
VPN_TLS_AUTH_KEY: ${{ secrets.PROTONVPN_TLS_AUTH_KEY }} | |
- name: Update Data Locally | |
run: cicd/etl.sh --env prod pynba_update | |
- name: Disconnect from ProtonVPN | |
run: sudo killall openvpn | |
if: ${{ always() }} | |
- name: Sync to S3 | |
run: cicd/etl.sh --env prod pynba_sync | |
- name: Upload Artifact | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: data_output | |
path: data | |
- name: Deploy to Vercel | |
run: cicd/deploy.sh | |
env: | |
VERCEL_ACCOUNT_TOKEN: ${{secrets.VERCEL_ACCOUNT_TOKEN}} | |
VERCEL_DEPLOY_HOOK_URL: ${{secrets.VERCEL_DEPLOY_HOOK_URL}} |