Files
whisper-frontend/.gitea/workflows/deploy-branch.yaml
Andreas Svanberg 09332980d9
All checks were successful
Deploy to branch.dsv.su.se / Deploy-branch (pull_request) Successful in 1m0s
Clean up branch.dsv.su.se / Cleanup-branch (pull_request) Successful in 7s
Give steps proper names
2024-07-08 14:24:57 +02:00

38 lines
1.4 KiB
YAML

name: Deploy to branch.dsv.su.se
on:
pull_request:
types:
- opened
- reopened
- ready_for_review
jobs:
Deploy-branch:
runs-on: ubuntu-latest
steps:
- name: Generate mangled vhost name
id: mangled-name
run: |
MANGLED_BRANCH_NAME="$(echo ${{ gitea.headref}} | sed -r -e 's%/%-%g' -e 's/[^0-9a-z\-]//g')"
echo $MANGLED_BRANCH_NAME
echo "MANGLED_NAME=$MANGLED_BRANCH_NAME" >> "$GITHUB_OUTPUT"
- name: Set up SSH key
run: |
echo "${{ secrets.BRANCH_DEPLOY_KEY }}" >> ssh_key
chmod 0600 ssh_key
- name: Execute deploy script
run: echo "${{ gitea.serverurl }}/${{ gitea.repository }}.git ${{ gitea.headref }} ${{ steps.mangled-name.outputs.MANGLED_NAME }}" | ssh -o StrictHostKeyChecking=accept-new -i ssh_key branch.dsv.su.se
- name: Post URL to deployment as comment
uses: actions/github-script@v7
env:
MANGLED_BRANCH_NAME: ${{ steps.mangled-name.outputs.MANGLED_NAME }}
with:
script: |
const repositoryName = context.repo.repo;
const mangledBranchName = process.env.MANGLED_BRANCH_NAME;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `https://${repositoryName}-${mangledBranchName}.branch.dsv.su.se`
})