name: Docker Compose Remove Stack on: workflow_call: secrets: DEPLOY_HOST: required: true type: string DEPLOY_USERNAME: required: true type: string DEPLOY_SSHKEY: required: true type: string DEPLOY_PORT: required: true type: string PUSHOVER_USER_TOKEN: required: true type: string jobs: deploy: runs-on: ubuntu-latest steps: - name: Notify Build Start uses: umahmood/pushover-actions@main env: PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_APP_TOKEN }} PUSHOVER_USER: ${{ secrets.PUSHOVER_USER_TOKEN }} with: status: ${{ job.status }} title: 'Stack Removal Started' url: "${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}" url_title: 'View Deployment' - name: "[ON RUNNER] Set project variables" run: | projectname="${{ gitea.event.repository.name }}" echo "project_name=$projectname" >> $GITEA_ENV echo "project_folder=/home/${{ secrets.DEPLOY_USERNAME }}/$projectname" >> $GITEA_ENV - name: "[ON HOST] Remove Stack" uses: appleboy/ssh-action@v1.2.2 with: host: ${{ secrets.DEPLOY_HOST }} username: ${{ secrets.DEPLOY_USERNAME }} key: ${{ secrets.DEPLOY_SSHKEY }} port: ${{ secrets.DEPLOY_PORT }} script: | cd ${{ env.project_folder }} docker compose --env-file .env down cd .. rm -rf ${{ env.project_folder }} - name: Notify Build End uses: umahmood/pushover-actions@main if: ${{ !cancelled() }} env: PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }} PUSHOVER_USER: ${{ secrets.PUSHOVER_USER }} with: status: ${{ job.status }} title: "Stack Removal ${{ job.status }}" url: "${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}" url_title: 'View Logs'