diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2e0a1ada44..fe632c33b4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 }} diff --git a/.github/workflows/deploy_develop.yaml b/.github/workflows/deploy_develop.yaml deleted file mode 100644 index ab458b1c6b..0000000000 --- a/.github/workflows/deploy_develop.yaml +++ /dev/null @@ -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 }} diff --git a/scripts/deploy.py b/scripts/deploy.py index a0e8d96dcb..200dd5f1fc 100755 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -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. diff --git a/scripts/get-version-from-git.sh b/scripts/get-version-from-git.sh index f3abdcb7c7..eb9729c78e 100755 --- a/scripts/get-version-from-git.sh +++ b/scripts/get-version-from-git.sh @@ -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