Automatically deploy pull requests for testing #8
@ -9,19 +9,27 @@ jobs:
|
|||||||
Deploy-branch:
|
Deploy-branch:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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"
|
||||||
- run: |
|
- run: |
|
||||||
echo "${{ secrets.BRANCH_DEPLOY_KEY }}" >> ssh_key
|
echo "${{ secrets.BRANCH_DEPLOY_KEY }}" >> ssh_key
|
||||||
chmod 0600 ssh_key
|
chmod 0600 ssh_key
|
||||||
- run: echo "${{ gitea.serverurl }}/${{ gitea.repository }}.git ${{ gitea.headref }}" | ssh -o StrictHostKeyChecking=accept-new -i ssh_key branch.dsv.su.se
|
- 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: View context attributes
|
- name: View context attributes
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
|
env:
|
||||||
|
MANGLED_BRANCH_NAME: ${{ steps.mangled-name.outputs.MANGLED_NAME }}
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const repositoryName = context.repo.repo;
|
const repositoryName = context.repo.repo;
|
||||||
const branchName = context.payload.pull_request.head.ref;
|
const mangledBranchName = process.env.MANGLED_BRANCH_NAME;
|
||||||
github.rest.issues.createComment({
|
github.rest.issues.createComment({
|
||||||
issue_number: context.issue.number,
|
issue_number: context.issue.number,
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: `https://${repositoryName}-${branchName}.branch.dsv.su.se`
|
body: `https://${repositoryName}-${mangledBranchName}.branch.dsv.su.se`
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user