Improve ci #3
Workflow file for this run
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: test workflow | |
on: | |
push: | |
branches: | |
- main | |
- mwp_v1 | |
pull_request: | |
paths: | |
- ".github/**" | |
jobs: | |
deploy_demo: | |
name: deploy_demo | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get version from tag | |
id: extract_version | |
run: | | |
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
shell: bash | |
# https://stackoverflow.com/questions/60477061/github-actions-how-to-deploy-to-remote-server-using-ssh | |
- name: Write SSH config & key | |
id: write_ssh_keys | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_CONFIG: ${{ secrets.SSH_CONFIG }} | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_ed25519 | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 | |
echo "$SSH_CONFIG" > ~/.ssh/config | |
shell: bash | |
- name: Add server to known hosts | |
run: | | |
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
shell: bash | |
- name: Connect to server | |
id: connect_to_server | |
env: | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
run: | | |
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 $SSH_HOST | |
echo "Connected to server" > test.txt | |
shell: bash |