diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 000000000..aab5d5adc --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,22 @@ +name: sms-frontend workflow + +on: + push: + branches: + - dev + +jobs: + deploy: + runs-on: self-hosted + steps: + - name: SSH and deploy for frontend + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: ${{ secrets.PORT }} + script: | + cd simple-node-js-react-npm-app + git pull https://${{ secrets.USERNAME_GIT }}:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/annas-whizpool/simple-node-js-react-npm-app.git dev + ls -la diff --git a/.github/workflows/rollback.yml b/.github/workflows/rollback.yml new file mode 100644 index 000000000..01bc6c2db --- /dev/null +++ b/.github/workflows/rollback.yml @@ -0,0 +1,27 @@ +name: Rollback testing + +on: + workflow_dispatch: + inputs: + commit_hash: + description: 'Commit hash to rollback to' + required: true + default: '' + # Only allow running this from the development branch button will only appear when the development branch is selected + +jobs: + rollback-backend: + runs-on: self-hosted + steps: + - name: SSH and deploy for frontend + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: ${{ secrets.PORT }} + script: | + cd simple-node-js-react-npm-app + COMMIT_HASH="${{ github.event.inputs.commit_hash }}" + echo "Resetting to specific commit $COMMIT_HASH..." + git reset --hard $COMMIT_HASH diff --git a/README.md b/README.md index 8a36e36b2..07e29552c 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,4 @@ check that the application renders satisfactorily. The `jenkins` directory contains an example of the `Jenkinsfile` (i.e. Pipeline) you'll be creating yourself during the tutorial and the `scripts` subdirectory contains shell scripts with commands that are executed when Jenkins processes -the "Test" and "Deliver" stages of your Pipeline. +the "Test" and "Deliver" stages of your Pipeline.1234