Add deploy website #6
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: ["*"] | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
# Skip intermediate builds: always. | |
# Cancel intermediate builds: only if it is a pull request build. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
jobs: | |
ci: | |
environment: default | |
runs-on: self-hosted | |
steps: | |
- name: Write SSH keys | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_key | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_key | |
host='app' | |
hosts="$(dig +short "$host" | grep -v '\.$' | sed -z 's|\n|,|g')$host" | |
ssh-keyscan -H "$hosts" > ~/.ssh/known_hosts | |
- uses: actions/checkout@v4 | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
- name: Deploy website | |
run: | | |
ssh app hostname |