Compare commits

..

No commits in common. "d5fc2adfe1cebe0b207441aa6c2bff897505e696" and "6911482c0e299bc5b1186ad2607d3ed4f9eb8114" have entirely different histories.

2 changed files with 7 additions and 21 deletions

View file

@ -1,7 +1,7 @@
on: on:
pull_request: pull_request:
types: pull_request_target:
- closed - closed
jobs: jobs:
cleanup-staging: cleanup-staging:
@ -11,13 +11,9 @@ jobs:
steps: steps:
- name: Pipeline info PR - name: Pipeline info PR
run: | run: |
echo "Run triggered by ${{ github.event_name }} (${{ github.event.action }}) on ref ${{ github.ref_name }}" echo "PR#${{ github.event.pull_request.number }} ${{ github.event.action }}"
- name: Staging Deployment - Prepare keys - name: Deploy - Remove PR from staging
if: github.event.action == 'closed'
run: | run: |
echo "${{ secrets.SSH_DEPLOY_KEY }}" > deploykey.priv ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts' ccchh-website-deploy@public-web-static-intern.hamburg.ccc.de -t "rm -r /var/www/next.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/"
chmod 400 deploykey.priv
echo "${{ secrets.SSH_KNOWN_HOSTS_FILE }}" > ./known_hosts
- name: Staging Deployment - Remove PR from staging
run: |
ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts' ccchh-website-deploy@public-web-static-intern.hamburg.ccc.de -t "rm -r /var/www/staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/"

View file

@ -17,7 +17,7 @@ jobs:
steps: steps:
- name: Pipeline info - name: Pipeline info
run: | run: |
echo "Run triggered by ${{ github.event_name }} (${{ github.event.action }}) on ref ${{ github.ref_name }}" echo "Run triggered by ${{ gitea.event_name }} on ref ${{ github.ref_name }}"
- name: Install packages - name: Install packages
run: | run: |
@ -54,16 +54,6 @@ jobs:
run: | run: |
echo "Deploying to staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}" echo "Deploying to staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}"
rsync -v -r --delete -e "ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts'" public/ ccchh-website-deploy@public-web-static-intern.hamburg.ccc.de:/var/www/staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/ rsync -v -r --delete -e "ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts'" public/ ccchh-website-deploy@public-web-static-intern.hamburg.ccc.de:/var/www/staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/
- name: Deploy - Add comment to PR with staging URL
if: github.event_name == 'pull_request' && github.event.action == 'opened'
run: |
curl \
-X POST \
${{ github.event.pull_request.base.repo.url }}/issues/${{ github.event.pull_request.number }}/comments \
-H "Content-Type: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
--data '{ "body": "You can view your changes at https://staging.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/" }'
- name: Deploy - Upload to prod - name: Deploy - Upload to prod
if: github.event_name == 'push' && github.ref_name == 'main' if: github.event_name == 'push' && github.ref_name == 'main'
run: | run: |