CI: Auto-remove closed PRs from staging #40

Merged
june merged 2 commits from feature/ci-staging-comment into main 2024-01-28 20:04:01 +01:00
Showing only changes of commit d5fc2adfe1 - Show all commits

View file

@ -17,7 +17,7 @@ jobs:
steps: steps:
- name: Pipeline info - name: Pipeline info
run: | run: |
echo "Run triggered by ${{ gitea.event_name }} on ref ${{ github.ref_name }}" echo "Run triggered by ${{ github.event_name }} (${{ github.event.action }}) on ref ${{ github.ref_name }}"
- name: Install packages - name: Install packages
run: | run: |
@ -54,6 +54,16 @@ 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: |