Skip to content

Create roycornelissen.md #25

Create roycornelissen.md

Create roycornelissen.md #25

Workflow file for this run

name: Provision Participant environment
on:
pull_request:
branches:
- main
paths:
- profiles/**
types:
- closed
workflow_dispatch:
inputs:
githubhandle:
required: true
type: text
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get PR creator
id: github_handle
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
if ("${{ github.event_name }}" == "pull_request") {
const pr = context.payload.pull_request;
const creator = pr.user.login;
console.log(`PR Creator: ${creator}`);
return creator;
} else {
return "${{ github.event.inputs.githubhandle }}";
}
- name: Install GH Collab
run: |
gh extension install mislav/gh-repo-collab
env:
GH_TOKEN: ${{ secrets.VSLIVE_REPOCREATE }}
- name: Create Repository
env:
GH_TOKEN: ${{ secrets.VSLIVE_REPOCREATE }}
run: |
# Create clone of this repo for user
gh repo create XpiritCommunityEvents/${{ steps.github_handle.outputs.result }} \
--public \
--template ${{ github.repository }}
- name: Set Rights to Repo
env:
GH_TOKEN: ${{ secrets.VSLIVE_REPOCREATE }}
run: |
# Add user to newly cloned repo
gh repo-collab add XpiritCommunityEvents/${{ steps.github_handle.outputs.result }} ${{ steps.github_handle.outputs.result }} --permission admin | cat
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create Azure resource
uses: Azure/[email protected]
with:
inlineScript: |
# Set variables
RESOURCE_GROUP_NAME=rg-${{ steps.github_handle.outputs.result }}
APP_SERVICE_PLAN_NAME=asp-${{ steps.github_handle.outputs.result }}
WEBAPP_CATALOG="app-${{ steps.github_handle.outputs.result }}-catalog"
WEBAPP_ORDERING="app-${{ steps.github_handle.outputs.result }}-ordering"
WEBAPP_FRONTEND="app-${{ steps.github_handle.outputs.result }}-frontend"
az group create -l eastus -n $RESOURCE_GROUP_NAME --tags vslive=2023
# Create an App Service Plan
az appservice plan create --name $APP_SERVICE_PLAN_NAME --resource-group $RESOURCE_GROUP_NAME --sku S1 --tags vslive=2023
# Create Web Apps
az webapp create --name $WEBAPP_CATALOG --resource-group $RESOURCE_GROUP_NAME --plan $APP_SERVICE_PLAN_NAME --tags vslive=2023
az webapp create --name $WEBAPP_ORDERING --resource-group $RESOURCE_GROUP_NAME --plan $APP_SERVICE_PLAN_NAME --tags vslive=2023
az webapp create --name $WEBAPP_FRONTEND --resource-group $RESOURCE_GROUP_NAME --plan $APP_SERVICE_PLAN_NAME --tags vslive=2023
- name: Run User Provisioning Script
shell: pwsh
run: |
./provisioning/gh-aad.ps1 -githubHandle ${{ steps.github_handle.outputs.result }} -AzureCredentialsJson '${{ secrets.AZURE_CREDENTIALS }}' -InitialPassword '{{ secrets.INITIALPASSWORD }}' -runLocal $false