Merge pull request #31 from pet-informatica/rigaud #13
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 | |
on: | |
push: | |
branches: | |
["master"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: './manual' | |
- name: Add L2TP Network Manager PPA | |
shell: bash | |
run: sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp -y | |
- name: Install L2TP Network Manager | |
shell: bash | |
run: sudo apt install network-manager-l2tp -y | |
- name: Create UFPE VPN | |
shell: bash | |
run: sudo nmcli connection add connection.id CINUFPE con-name CINUFPE type VPN vpn-type l2tp ifname -- connection.autoconnect no ipv4.method auto vpn.data "gateway = ${{ secrets.VPN_GATEWAY }}, ipsec-enabled = yes, mru = 1400, mtu = 1400, password-flags = 0, refuse-chap = yes, refuse-mschap = yes, refuse-pap = yes, require-mppe = yes, user = ${{ secrets.USER }}" vpn.secrets "password=${{ secrets.PASSWORD }}, ipsec-psk = ${{ secrets.PSK }}" | |
- name: Own route | |
shell: bash | |
run: sudo ip route add default via 127.0.0.1 | |
- name: Connect UFPE VPN | |
shell: bash | |
run: nmcli c up $(nmcli c show | grep CINUFPE | awk '{print $2'}) | |
- name: Pack changes | |
shell: bash | |
run: tar -czvf manual.tar.gz ./manual | |
- name: Upload changes | |
shell: bash | |
run: sshpass -p ${{ secrets.SSH_PASS }} scp -o StrictHostKeyChecking=accept-new ./manual.tar.gz ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_PATH }} | |
- name: Unpack (deploy) changes | |
shell: bash | |
run: sshpass -p ${{ secrets.SSH_PASS }} ssh -o StrictHostKeyChecking=accept-new ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} tar -xzf ${{ secrets.SSH_PATH}}/manual.tar.gz |