Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Deploy to S3 Nightly #309

Deploy to S3 Nightly

Deploy to S3 Nightly #309

name: Deploy to S3 Nightly
on:
schedule:
- cron: "30 2 * * *"
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
env:
NIGHTLY_BUILD: true
jobs:
check_date:
runs-on: ubuntu-22.04
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
nightly:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Select NodeJS version
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
# renovate: datasource=docker depName=node versioning=node
node-version: "20.12.2"
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: yarn install
- name: Build documentation
run: |
# Build projects & documentation
yarn workspace @plantdb/libplantdb build
yarn workspace @plantdb/plant-nursery build --base=/nursery/
yarn workspace @plantdb/libplantdb docs
yarn docs:build
# Put nursery and docs on same deployment behind landing-page
mkdir /tmp/plant-deploy
cp packages/landing-page/index.html /tmp/plant-deploy/
cp --recursive packages/documentation/public \
/tmp/plant-deploy/docs
cp --recursive packages/plant-nursery/output \
/tmp/plant-deploy/nursery
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Deploy to S3
run: |
aws s3 sync /tmp/plant-deploy s3://${{ secrets.AWS_S3_BUCKET }} --no-progress