written by relyq
published on: 2023-04-28
it do be continuous
spent a few hours learning a bit of ci/cd before deploying a webapp to aws as i figured it would be useful
took a bit to figure each job ran on its own instance so they didnt share artifacts but now updates to this site are deployed automatically
the repo might not be public yet but here’s the workflow file: https://github.com/relyq/relyq.dev/blob/master/.github/workflows/astro.yml
https://docs.github.com/en/actions/learn-github-actions
name: Deploy Astro site to ftp server
on:
push:
branches: ["master"]
workflow_dispatch:
concurrency:
group: "ftp"
cancel-in-progress: false
env:
BUILD_PATH: "."
jobs:
build:
name: build & deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/[email protected]
with:
node-version: "18.16.0"
- name: setup pnpm
uses: pnpm/[email protected]
with:
version: 7.18.1
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install dependencies
run: pnpm install
- name: Build with Astro
run: pnpm astro build
working-directory: ${{ env.BUILD_PATH }}
- name: FTP Deploy
id: ftp
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.ftp_server }}
username: ${{ secrets.ftp_username }}
password: ${{ secrets.ftp_password }}
port: 21
protocol: ftp
local-dir: ${{ env.BUILD_PATH }}/dist/
server-dir: public_html/
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
**/resume.pdf
@relyq on discord!!!