Deploying kbsb-demodash (fred-snyder). #16
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: Deploy kbsb-demodash | |
run-name: Deploying kbsb-demodash (${{ github.actor }}). | |
on: | |
push: | |
branches: | |
# - main | |
- fs-117-ci-cd # test CI/CD config | |
jobs: | |
deploy-frontend: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} | |
RCLONE_SYNC_DIR: dist | |
RCLONE_REMOTE: scw | |
RCLONE_BUCKET_NAME: demodash.kbsb.app | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
# Build the Node project | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install `pnpm` | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build frontend | |
run: make build | |
- name: List dist folder | |
run: ls dist | |
# Upload to Scaleway | |
- name: Install Rclone | |
run: sudo -v ; curl https://rclone.org/install.sh | sudo bash | |
- name: Verify `rclone` | |
run: rclone --version | |
- name: Create Rclone configuration file | |
run: | | |
echo "[scw]" > rclone.conf | |
echo "type = s3" >> rclone.conf | |
echo "provider = Scaleway" >> rclone.conf | |
echo "env_auth = true" >> rclone.conf | |
echo "region = nl-ams" >> rclone.conf | |
echo "endpoint = s3.nl-ams.scw.cloud" >> rclone.conf | |
echo "acl = private" >> rclone.conf | |
echo "bucket_acl = private" >> rclone.conf | |
- name: Verify `rlcone.conf` | |
run: cat rclone.conf | |
- name: Copy `dist` folder to Scaleway bucket | |
run: rclone sync --auto-confirm --config="rclone.conf" ./"$RCLONE_SYNC_DIR"/ "$RCLONE_REMOTE":"$RCLONE_BUCKET_NAME" | |
# Cloudflare cache | |
- name: Purge Cloudflare cache | |
run: echo "purge Cloudflare cache" | |
deploy-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- run: python --version | |
- run: make --version |