Deploy #27
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 | |
on: | |
push: | |
branches: [$default-branch] | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: self-hosted | |
container: | |
image: 'joel/alpine' | |
environment: vps | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x, 22.x] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'yarn' | |
- run: | | |
echo "${{ job.container.id }}" | |
echo "${{ vars }}" | |
- run: yarn install | |
- run: yarn build | |
- name: docker-cp | |
uses: tj-actions/docker-cp@v2 | |
with: | |
container: ${{ job.container.id }} | |
source: './public' | |
destination: ${{ vars.output_path }} | |
local: true | |
# Additional options passed to [docker cp](https://docs.docker.com/engine/reference/commandline/cp/#options) | |
# options: | |
# - name: Copy repository contents via scp | |
# uses: c0c1/scp-action@v1.0 | |
# with: | |
# host: ${{ secrets.HOST }} | |
# user: ${{ secrets.USERNAME }} | |
# port: ${{ secrets.PORT }} | |
# key: ${{ secrets.SSH_KEY }} | |
# source: './public' | |
# remote: '/var/www/joel.fm/build' | |
# - name: SSH action | |
# uses: tiyee/action-ssh@v1.0.1 | |
# with: | |
# host: ${{ secrets.HOST }} | |
# username: ${{ secrets.USERNAME }} | |
# port: ${{ secrets.PORT }} | |
# privateKey: ${{ secrets.SSH_KEY }} | |
# command: | | |
# cd /var/www/joel.fm && | |
# rm -rf /var/www/joel.fm/html-test && | |
# ./scripts/symlinks.sh |