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: Build and deploy dance-app | |
on: | |
push: | |
branches: ["master", "actions"] | |
paths: | |
- "dance-app/**" | |
- ".github/workflows/dance-app.yml" | |
pull_request: | |
branches: ["master"] | |
jobs: | |
dance-app: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
working-directory: dance-app | |
run: pnpm install | |
- name: Build dance-app | |
working-directory: dance-app | |
run: pnpm build | |
- name: | |
Install ssh keys | |
# check this thread to understand why its needed: | |
# <https://stackoverflow.com/a/70447517> | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_rsa | |
echo "${{ secrets.M }}" > ~/.ssh/id_rsa | |
ssh-keyscan -H junction.nyman.dev > ~/.ssh/known_hosts | |
- name: Copy dance-app | |
working-directory: dance-app | |
run: scp -r dist/* [email protected]:/usr/share/caddy | |
- name: cleanup | |
run: rm -rf ~/.ssh |