HTM-948: skip build and deploy steps when the PR author is Dependabot #17
Workflow file for this run
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: 'Remove deployment' | |
on: | |
pull_request: | |
types: [ closed ] | |
jobs: | |
cleanup: | |
name: 'Remove Docker Compose deployment' | |
runs-on: ubuntu-22.04 | |
if: vars.DEPLOY == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Set variables for PR' | |
env: | |
PR: ${{ github.event.pull_request.number }} | |
PROJECT_NAME: ${{ vars.DEPLOY_PROJECT_NAME }} | |
run: | | |
echo "VERSION_TAG=pr-${PR}" >> $GITHUB_ENV | |
echo "COMPOSE_PROJECT_NAME=${PROJECT_NAME}-pr-${PR}" >> $GITHUB_ENV | |
- uses: arwynfr/actions-docker-context@v2 | |
with: | |
docker_host: ${{ secrets.DEPLOY_DOCKER_HOST }} | |
context_name: 'dev-server' | |
ssh_cert: ${{ secrets.DEPLOY_DOCKER_HOST_SSH_CERT }} | |
ssh_key: ${{ secrets.DEPLOY_DOCKER_HOST_SSH_KEY }} | |
use_context: true | |
- name: 'Add known hosts' | |
run: | | |
DEPLOY_DOCKER_HOST=${{ secrets.DEPLOY_DOCKER_HOST }} | |
ssh-keyscan -H ${DEPLOY_DOCKER_HOST##*@} > $HOME/.ssh/known_hosts | |
- uses: actions/checkout@v4 | |
with: | |
repository: B3Partners/tailormap-viewer | |
path: tailormap-viewer | |
sparse-checkout: | | |
docker-compose*.yml | |
sparse-checkout-cone-mode: false | |
- name: 'Remove pull request deployment and image' | |
env: | |
COMPOSE_FILE: docker-compose.yml:docker-compose.traefik.yml:ci/docker-compose.pr.yml | |
VERSION: ${{ env.VERSION_TAG }} | |
TAILORMAP_IMAGE: ${{ vars.DEPLOY_IMAGE_TAG }} | |
run: | | |
cd tailormap-viewer | |
docker compose config | |
docker compose down --rmi all --volumes --remove-orphans | |
- name: 'GitHub Slug Action' | |
uses: rlespinasse/github-slug-action@v4 | |
- name: 'Remove GitHub deployment and environment' | |
if: ${{ always() }} | |
uses: strumwolf/[email protected] | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
environment: test | |
onlyRemoveDeployments: true | |
ref: "${{ env.GITHUB_HEAD_REF }}" | |