Consolidate deployment management into more maintained action (#8430)
This commit is contained in:
parent
b4da870af1
commit
92f440d9de
6 changed files with 49 additions and 57 deletions
10
.github/workflows/element-build-and-test.yaml
vendored
10
.github/workflows/element-build-and-test.yaml
vendored
|
@ -8,13 +8,14 @@ on:
|
|||
branches: [ develop, master ]
|
||||
repository_dispatch:
|
||||
types: [ upstream-sdk-notify ]
|
||||
env:
|
||||
# These must be set for fetchdep.sh to get the right branch
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
jobs:
|
||||
build:
|
||||
name: "Build Element-Web"
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# This must be set for fetchdep.sh to get the right branch
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
@ -90,9 +91,6 @@ jobs:
|
|||
app-tests:
|
||||
name: Element Web Integration Tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# This must be set for fetchdep.sh to get the right branch
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
|
7
.github/workflows/end-to-end-tests.yaml
vendored
7
.github/workflows/end-to-end-tests.yaml
vendored
|
@ -9,12 +9,13 @@ on:
|
|||
branches: [ develop ]
|
||||
repository_dispatch:
|
||||
types: [ upstream-sdk-notify ]
|
||||
env:
|
||||
# These must be set for fetchdep.sh to get the right branch
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
jobs:
|
||||
end-to-end:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# This must be set for fetchdep.sh to get the right branch
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
container: vectorim/element-web-ci-e2etests-env:latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
|
55
.github/workflows/netlify.yaml
vendored
55
.github/workflows/netlify.yaml
vendored
|
@ -25,40 +25,40 @@ jobs:
|
|||
echo "PR number: $pr_number"
|
||||
echo "::set-output name=prnumber::$pr_number"
|
||||
|
||||
- name: Create Deployment ID
|
||||
uses: altinukshini/deployment-action@v1.2.6
|
||||
- name: Create Deployment
|
||||
uses: bobheadxi/deployments@v1
|
||||
id: deployment
|
||||
with:
|
||||
token: "${{ secrets.ELEMENT_BOT_TOKEN }}"
|
||||
pr: true
|
||||
pr_id: ${{ steps.readctx.outputs.prnumber }}
|
||||
transient_environment: true
|
||||
environment: Netlify
|
||||
initial_status: in_progress
|
||||
step: start
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
env: Netlify
|
||||
ref: ${{ github.event.workflow_run.head_sha }}
|
||||
desc: |
|
||||
Do you trust the author of this PR? Maybe this build will steal your keys or give you malware.
|
||||
Exercise caution. Use test accounts.
|
||||
|
||||
# There's a 'download artifact' action but it hasn't been updated for the
|
||||
# There's a 'download artifact' action, but it hasn't been updated for the
|
||||
# workflow_run action (https://github.com/actions/download-artifact/issues/60)
|
||||
# so instead we get this mess:
|
||||
- name: 'Download artifact'
|
||||
uses: actions/github-script@v3.1.0
|
||||
with:
|
||||
script: |
|
||||
var artifacts = await github.actions.listWorkflowRunArtifacts({
|
||||
const artifacts = await github.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: ${{github.event.workflow_run.id }},
|
||||
run_id: ${{ github.event.workflow_run.id }},
|
||||
});
|
||||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
||||
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "previewbuild"
|
||||
})[0];
|
||||
var download = await github.actions.downloadArtifact({
|
||||
const download = await github.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
var fs = require('fs');
|
||||
const fs = require('fs');
|
||||
fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data));
|
||||
|
||||
- name: Extract Artifacts
|
||||
|
@ -79,25 +79,16 @@ jobs:
|
|||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
timeout-minutes: 1
|
||||
|
||||
- name: Update deployment status (success)
|
||||
if: success()
|
||||
uses: altinukshini/deployment-status@v1.0.1
|
||||
- name: Update deployment status
|
||||
uses: bobheadxi/deployments@v1
|
||||
if: always()
|
||||
with:
|
||||
token: "${{ secrets.ELEMENT_BOT_TOKEN }}"
|
||||
environment_url: ${{ steps.netlify.outputs.deploy-url }}
|
||||
state: "success"
|
||||
step: finish
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
status: ${{ job.status }}
|
||||
env: ${{ steps.deployment.outputs.env }}
|
||||
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
|
||||
pr: true
|
||||
pr_id: ${{ steps.readctx.outputs.prnumber }}
|
||||
description: |
|
||||
env_url: ${{ steps.netlify.outputs.deploy-url }}
|
||||
desc: |
|
||||
Do you trust the author of this PR? Maybe this build will steal your keys or give you malware.
|
||||
Exercise caution. Use test accounts.
|
||||
- name: Update deployment status (failure)
|
||||
if: failure()
|
||||
uses: altinukshini/deployment-status@v1.0.1
|
||||
with:
|
||||
token: "${{ secrets.ELEMENT_BOT_TOKEN }}"
|
||||
state: "failure"
|
||||
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
|
||||
pr: true
|
||||
pr_id: ${{ steps.readctx.outputs.prnumber }}
|
||||
|
|
7
.github/workflows/static_analysis.yaml
vendored
7
.github/workflows/static_analysis.yaml
vendored
|
@ -5,13 +5,14 @@ on:
|
|||
branches: [ develop, master ]
|
||||
repository_dispatch:
|
||||
types: [ upstream-sdk-notify ]
|
||||
env:
|
||||
# These must be set for fetchdep.sh to get the right branch
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
jobs:
|
||||
ts_lint:
|
||||
name: "Typescript Syntax Check"
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# This must be set for fetchdep.sh to get the right branch
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
|
7
.github/workflows/tests.yml
vendored
7
.github/workflows/tests.yml
vendored
|
@ -5,13 +5,14 @@ on:
|
|||
branches: [ develop, master ]
|
||||
repository_dispatch:
|
||||
types: [ upstream-sdk-notify ]
|
||||
env:
|
||||
# These must be set for fetchdep.sh to get the right branch
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
jobs:
|
||||
jest:
|
||||
name: Jest with Codecov
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# This must be set for fetchdep.sh to get the right branch
|
||||
PR_NUMBER: ${{github.event.number}}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
|
|
@ -29,7 +29,7 @@ getPRInfo() {
|
|||
if [ -n "$number" ]; then
|
||||
echo "Getting info about a PR with number $number"
|
||||
|
||||
apiEndpoint="https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/"
|
||||
apiEndpoint="https://api.github.com/repos/${REPOSITORY:-"matrix-org/matrix-react-sdk"}/pulls/"
|
||||
apiEndpoint+=$number
|
||||
|
||||
head=$(curl $apiEndpoint | jq -r '.head.label')
|
||||
|
@ -66,9 +66,9 @@ fi
|
|||
clone ${TRY_ORG} $defrepo ${TRY_BRANCH}
|
||||
|
||||
# Try the target branch of the push or PR.
|
||||
if [ -n $GITHUB_BASE_REF ]; then
|
||||
if [ -n "$GITHUB_BASE_REF" ]; then
|
||||
clone $deforg $defrepo $GITHUB_BASE_REF
|
||||
elif [ -n $BUILDKITE_PULL_REQUEST_BASE_BRANCH ]; then
|
||||
elif [ -n "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" ]; then
|
||||
clone $deforg $defrepo $BUILDKITE_PULL_REQUEST_BASE_BRANCH
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue