This commit is contained in:
Michael Telatynski 2022-04-27 12:38:09 +01:00
parent 89b3e4aaab
commit 449a0e64d9
4 changed files with 63 additions and 64 deletions

View file

@ -40,3 +40,62 @@ jobs:
name: previewbuild
path: dist/*.tar.gz
retention-days: ${{ github.ref == 'develop' && 1 || 28 }}
deploy:
needs: build
runs-on: ubuntu-latest
# if: github.event_name == 'push' && github.ref == 'develop'
steps:
- name: Create Deployment ID
uses: altinukshini/deployment-action@releases/v1.2.6
id: deployment
with:
token: "${{ github.token }}"
environment_url: https://develop.element.io
environment: Develop
initial_status: in_progress
pr: true
pr_id: ${{ github.event.pull_request.number }}
ref: ${{ github.head_ref }}
- name: Find Artifact ID
uses: actions/github-script@v3.1.0
id: find_artifact
with:
result-encoding: string
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.run_id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "previewbuild"
})[0];
return matchArtifact.id;
# TODO
- name: Invoke deployment hook
uses: distributhor/workflow-webhook@v2
env:
webhook_url: https://test.tun.bit.ovh
webhook_secret: FooBar
data: '{ "artifact_id": "${{steps.find_artifact.outputs.result}}" }'
- name: Update deployment status (success)
if: success()
uses: altinukshini/deployment-status@releases/v1
with:
token: "${{ github.token }}"
environment_url: https://develop.element.io
state: "success"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
pr: true
pr_id: ${{ github.event.pull_request.number }}
- name: Update deployment status (failure)
if: failure()
uses: altinukshini/deployment-status@releases/v1
with:
token: "${{ github.token }}"
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

View file

@ -1,60 +0,0 @@
name: Deploy develop.element.io
concurrency: develop_deploy
on:
workflow_run:
workflows: [ "Build" ]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
# if: github.ref == 'develop'
steps:
- name: Create Deployment ID
uses: altinukshini/deployment-action@releases/v1.2.6
id: deployment
with:
token: "${{ github.token }}"
target_url: https://develop.element.io
ref: ${{ github.ref }}"
environment: "develop"
- name: Find Artifact ID
uses: actions/github-script@v3.1.0
id: find_artifact
with:
result-encoding: string
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "previewbuild"
})[0];
return matchArtifact.id;
# TODO
- name: Invoke deployment hook
uses: distributhor/workflow-webhook@v2
env:
webhook_url: https://test.tun.bit.ovh
webhook_secret: FooBar
data: '{ "artifact_id": "${{steps.find_artifact.outputs.result}}" }'
- name: Update deployment status (success)
if: success()
uses: altinukshini/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: https://develop.element.io
state: "success"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: altinukshini/deployment-status@releases/v1
with:
token: "${{ github.token }}"
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# download and unpack a element-web tarball.
#
# Allows `bundles` to be extracted to a common directory, and a link to
# config.json to be added.

View file

@ -4,7 +4,7 @@
# these dependencies are git checkouts.
# Since the deps are fetched from git, we can rev-parse
REACT_SHA=$(cd node_modules/matrix-react-sdk; git rev-parse --short=12 HEAD)
JSSDK_SHA=$(cd node_modules/matrix-js-sdk; git rev-parse --short=12 HEAD)
REACT_SHA=$(git -C node_modules/matrix-react-sdk rev-parse --short=12 HEAD)
JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=12 HEAD)
VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop
echo $VECTOR_SHA-react-$REACT_SHA-js-$JSSDK_SHA