-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy app.element.io & staging.element.io via Github Actions (#28525)
* Deploy app.element.io & staging.element.io via Github Actions Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Simplify - this check is done by the Environment protection Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
- Loading branch information
Showing
2 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
.github/actions/download-verify-element-tarball/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Upload release assets | ||
description: Uploads assets to an existing release and optionally signs them | ||
inputs: | ||
tag: | ||
description: GitHub release tag to fetch assets from. | ||
required: true | ||
out-file-path: | ||
description: Path to where the webapp should be extracted to. | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Download current version for its old bundles | ||
id: current_download | ||
uses: robinraju/release-downloader@a96f54c1b5f5e09e47d9504526e96febd949d4c2 # v1 | ||
with: | ||
tag: steps.current_version.outputs.version | ||
fileName: element-*.tar.gz* | ||
out-file-path: ${{ runner.temp }}/download-verify-element-tarball | ||
|
||
- name: Verify tarball | ||
run: gpg --verify element-*.tar.gz.asc element-*.tar.gz | ||
working-directory: ${{ runner.temp }}/download-verify-element-tarball | ||
|
||
- name: Extract tarball | ||
run: tar xvzf element-*.tar.gz -C webapp --strip-components=1 | ||
working-directory: ${{ runner.temp }}/download-verify-element-tarball | ||
|
||
- name: Move webapp to out-file-path | ||
run: mv ${{ runner.temp }}/download-verify-element-tarball/webapp ${{ inputs.out-file-path }} | ||
|
||
- name: Clean up temp directory | ||
run: rm -R ${{ runner.temp }}/download-verify-element-tarball |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Manual deploy workflow for deploying to app.element.io & staging.element.io | ||
# Runs automatically for staging.element.io when an RC or Release is published | ||
# Note: Does *NOT* run automatically for app.element.io so that it gets tested on staging.element.io beforehand | ||
name: Build and Deploy ${{ inputs.site || 'staging.element.io' }} | ||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
site: | ||
description: Which site to deploy to | ||
required: true | ||
default: staging.element.io | ||
type: choice | ||
options: | ||
- staging.element.io | ||
- app.element.io | ||
concurrency: ${{ inputs.site || 'staging.element.io' }} | ||
permissions: {} | ||
jobs: | ||
deploy: | ||
name: "Deploy to Cloudflare Pages" | ||
runs-on: ubuntu-24.04 | ||
environment: ${{ inputs.site || 'staging.element.io' }} | ||
permissions: | ||
checks: read | ||
deployments: write | ||
env: | ||
SITE: ${{ inputs.site || 'staging.element.io' }} | ||
steps: | ||
- name: Load GPG key | ||
run: | | ||
curl https://packages.element.io/element-release-key.gpg | gpg --import | ||
gpg -k "$GPG_FINGERPRINT" | ||
env: | ||
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }} | ||
|
||
- name: Check current version on deployment | ||
id: current_version | ||
run: | | ||
echo "version=$(curl -s https://$SITE/version)" >> $GITHUB_OUTPUT | ||
# The current version bundle melding dance is skipped if the version we're deploying is the same | ||
# as then we're just doing a re-deploy of the same version with potentially different configs. | ||
- name: Download current version for its old bundles | ||
id: current_download | ||
if: steps.current_version.outputs.version != github.ref_name | ||
uses: element-hq/element-web/.github/actions/download-verify-element-tarball@${{ github.ref_name }} | ||
with: | ||
tag: steps.current_version.outputs.version | ||
out-file-path: current_version | ||
|
||
- name: Download target version | ||
uses: element-hq/element-web/.github/actions/download-verify-element-tarball@${{ github.ref_name }} | ||
with: | ||
tag: ${{ github.ref_name }} | ||
out-file-path: _deploy | ||
|
||
- name: Merge current bundles into target | ||
if: steps.current_download.outcome == 'success' | ||
run: cp -vnpr current_version/bundles/* _deploy/bundles/ | ||
|
||
- name: Copy config | ||
run: cp element.io/app/config.json _deploy/config.json | ||
|
||
- name: Populate 404.html | ||
run: echo "404 Not Found" > _deploy/404.html | ||
|
||
- name: Populate _headers | ||
run: cp .github/cfp_headers _deploy/_headers | ||
|
||
- name: Wait for other steps to succeed | ||
uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # fork | ||
with: | ||
ref: ${{ github.sha }} | ||
running-workflow-name: "Build and Deploy ${{ env.SITE }}" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
wait-interval: 10 | ||
check-regexp: ^((?!SonarCloud|SonarQube|issue|board|label|Release|prepare|GitHub Pages).)*$ | ||
|
||
- name: Deploy to Cloudflare Pages | ||
uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca # v1 | ||
with: | ||
apiToken: ${{ secrets.CF_PAGES_TOKEN }} | ||
accountId: ${{ secrets.CF_PAGES_ACCOUNT_ID }} | ||
projectName: ${{ env.SITE == 'staging.element.io' && 'element-web-staging' || 'element-web' }} | ||
directory: _deploy | ||
gitHubToken: ${{ secrets.GITHUB_TOKEN }} |
a2a066d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ever since this commit has been added, github created a pre-release for EVERY commit.
This means for me, who has email notifications set on new releases (in case of a stable one), that I get emails on every commit. Today, I've got 7 emails so far.
Please remove the pre-release creation from this commit.
a2a066d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github did no such thing, that is me in having to test things which can only be tested with a valid release tag, github actions has no way to locally test such actions.