64 lines
2.2 KiB
YAML
64 lines
2.2 KiB
YAML
# Triggers after the Build has finished,
|
|
# because artifacts are not externally available
|
|
# until the end of their workflow.
|
|
name: Deploy develop.element.io
|
|
concurrency: deploy_develop
|
|
on:
|
|
workflow_run:
|
|
workflows: [ "Build and upload sourcemaps to Sentry" ]
|
|
types:
|
|
- completed
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
environment: develop
|
|
if: github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- name: Find Artifact ID
|
|
uses: actions/github-script@v3.1.0
|
|
id: find_artifact
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
const artifacts = await github.actions.listWorkflowRunArtifacts({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{ github.event.workflow_run.id }},
|
|
});
|
|
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
|
return artifact.name == "previewbuild"
|
|
})[0];
|
|
const download = await github.actions.downloadArtifact({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
artifact_id: matchArtifact.id,
|
|
archive_format: 'zip',
|
|
});
|
|
return download.url;
|
|
|
|
- name: Create Deployment
|
|
uses: bobheadxi/deployments@v1
|
|
id: deployment
|
|
with:
|
|
step: start
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
env: Develop
|
|
ref: ${{ github.head_ref }}
|
|
|
|
- name: Notify the redeploy script
|
|
uses: distributhor/workflow-webhook@v2
|
|
env:
|
|
webhook_url: ${{ secrets.DEVELOP_DEPLOY_WEBHOOK_URL }}
|
|
webhook_secret: ${{ secrets.DEVELOP_DEPLOY_WEBHOOK_SECRET }}
|
|
data: '{"url": "${{ steps.find_artifact.outputs.result }}"}'
|
|
|
|
- name: Update deployment status
|
|
uses: bobheadxi/deployments@v1
|
|
if: always()
|
|
with:
|
|
step: finish
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
status: ${{ job.status }}
|
|
env: ${{ steps.deployment.outputs.env }}
|
|
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
|
|
env_url: https://develop.element.io
|