Deploy #2591
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: Deploy | |
on: | |
workflow_run: | |
workflows: ["Build & test"] | |
types: | |
- requested | |
concurrency: | |
group: deploy | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
if: >- | |
${{ ( | |
github.actor == 'LukasKalbertodt' || | |
github.actor == 'JulianKniephoff' || | |
github.actor == 'owi92' || | |
github.actor == 'lkiesow' | |
) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: prepare deploy key | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
install -dm 700 ~/.ssh/ | |
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
ssh-keyscan tobira.opencast.org >> ~/.ssh/known_hosts | |
- name: install ansible postgres extensions | |
run: ansible-galaxy collection install community.postgresql | |
# Now waiting for the CI step to finish. | |
- name: Wait for build to succeed | |
uses: lewagon/wait-on-check-action@v1.3.1 | |
with: | |
ref: ${{ github.event.workflow_run.head_commit.id }} | |
check-name: 'build' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download artifacts from build workflow | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
name: test-deployment-files | |
run_id: ${{ github.event.workflow_run.id }} | |
- name: Read Deploy ID | |
run: echo "DEPLOY_ID=$(cat .deploy-id)" >> $GITHUB_ENV | |
- name: Set GitHub deployment status to "Pending" | |
uses: bobheadxi/deployments@v1.3.0 | |
id: gh_deployment_start | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: test-deployment-${{ env.DEPLOY_ID }} | |
ref: ${{ github.event.workflow_run.head_commit.id }} | |
- name: Prepare files for deployment | |
run: | | |
cp -v tobira .deployment/files/ | |
cp -v util/dev-config/logo-large.svg .deployment/files/ | |
cp -v util/dev-config/logo-small.svg .deployment/files/ | |
cp -v util/dev-config/logo-large-dark.svg .deployment/files/ | |
cp -v util/dev-config/favicon.svg .deployment/files/ | |
cp -v util/dummy-login/dist/index.js .deployment/files/login-handler.js | |
- name: deploy tobira branch | |
working-directory: .deployment | |
env: | |
OPENCAST_ADMIN_PASSWORD: ${{ secrets.TOBIRA_OPENCAST_ADMIN_PASSWORD }} | |
TOBIRA_ADMIN_PASSWORD: ${{ secrets.TOBIRA_ADMIN_PASSWORD }} | |
run: > | |
ansible-playbook | |
--private-key=~/.ssh/id_ed25519 | |
--extra-vars="deployid='${{ env.DEPLOY_ID }}'" | |
-u github | |
deploy.yml | |
- name: Set GitHub deployment status to "deployed" | |
uses: bobheadxi/deployments@v1.3.0 | |
with: | |
step: finish | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: test-deployment-${{ env.DEPLOY_ID }} | |
status: ${{ job.status }} | |
deployment_id: ${{ steps.gh_deployment_start.outputs.deployment_id }} | |
env_url: ${{ format('https://{0}.tobira.opencast.org', env.DEPLOY_ID) }} |