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