Created
September 13, 2021 12:03
-
-
Save mmcguff/36dfe396b2574517385166caa129e0db to your computer and use it in GitHub Desktop.
Include this main.yml unalerted to the file path .github/workflows. Remember to set the required Github secrets to validate this is working. Additionally all your work needs to be organized inside the public_html folder in the repo.
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
# delete the directory | |
- name: Clear existing directories | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST}} | |
username: ${{ secrets.USERNAME}} | |
password: ${{ secrets.PASSWORD}} | |
port: ${{ secrets.PORT}} | |
script: rm -rf public_html | |
# copy files into public_html folder | |
- name: Copy from Repo to Linux Lab | |
uses: garygrossgarten/[email protected] | |
with: | |
# Path to the local folder you want to copy. | |
local: public_html | |
# Path on the remote server to copy to. | |
remote: public_html | |
# Hostname or IP address of the server. | |
host: ${{ secrets.HOST}} | |
# Username for authentication. | |
username: ${{ secrets.USERNAME}} | |
# Port number of the server. | |
port: ${{ secrets.PORT}} | |
# Password for password-based user authentication. | |
password: ${{ secrets.PASSWORD }} | |
# Set proper permission as everything by default is blocked | |
- name: Set Permissions | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST}} | |
username: ${{ secrets.USERNAME}} | |
password: ${{ secrets.PASSWORD}} | |
port: ${{ secrets.PORT}} | |
script: | | |
pwd | |
chmod 711 ~ | |
chmod 755 -R public_html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment