Run more of the deploy code for pre-releases (#1440)

This commit is contained in:
Michael Telatynski 2024-01-17 15:23:11 +00:00 committed by GitHub
parent bc4c4159dc
commit ae187445af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 12 deletions

View file

@ -48,6 +48,7 @@ jobs:
config: element.io/${{ inputs.mode || (github.event_name == 'release' && 'release') || 'nightly' }}
version: ${{ (inputs.mode != 'release' && github.event_name != 'release') && 'develop' || '' }}
nightly: ${{ inputs.mode != 'release' && github.event_name != 'release' }}
deploy: ${{ inputs.deploy || (github.event_name != 'workflow_dispatch' && github.event.release.prerelease != true) }}
secrets:
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_TOKEN: ${{ secrets.CF_R2_TOKEN }}
@ -102,15 +103,9 @@ jobs:
- linux
- windows
runs-on: ubuntu-latest
name: Deploy
if: |
always() && !failure() && !cancelled() && ((
github.event_name != 'workflow_dispatch' &&
github.event.release.prerelease != true
) || (
inputs.deploy && (inputs.macos || inputs.windows || inputs.linux)
))
environment: packages.element.io
name: ${{ needs.prepare.outputs.deploy && 'Deploy' || 'Deploy (dry-run)' }}
if: always() && !failure() && !cancelled()
environment: ${{ needs.prepare.outputs.deploy && 'packages.element.io' || '' }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
@ -185,7 +180,15 @@ jobs:
popd
fi
- name: Stash packages.element.io
if: ${{ !needs.prepare.outputs.deploy }}
uses: actions/upload-artifact@v4
with:
name: packages.element.io
path: packages.element.io
- name: Deploy artifacts
if: needs.prepare.outputs.deploy
run: |
aws s3 cp --recursive packages.element.io/ s3://$R2_BUCKET/$DEPLOYMENT_DIR --endpoint-url $R2_URL --region auto
env:
@ -195,6 +198,7 @@ jobs:
DEPLOYMENT_DIR: ${{ needs.prepare.outputs.packages-dir }}
- name: Notify packages.element.io of new files
if: needs.prepare.outputs.deploy
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2
with:
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
@ -210,9 +214,18 @@ jobs:
echo "$arch=$(ls linux-$arch-sqlcipher-system/*.deb | tail -n1)" >> $GITHUB_OUTPUT
done
- name: Stash debs
if: ${{ !needs.prepare.outputs.deploy && needs.linux.result == 'success' }}
uses: actions/upload-artifact@v4
with:
name: debs
path: |
${{ steps.deb.outputs.amd64 }}
${{ steps.deb.outputs.arm64 }}
- name: Publish amd64 deb to packages.element.io
uses: element-hq/packages.element.io@master
if: needs.linux.result == 'success'
if: needs.prepare.outputs.deploy && needs.linux.result == 'success'
with:
file: ${{ steps.deb.outputs.amd64 }}
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
@ -222,7 +235,7 @@ jobs:
- name: Publish arm64 deb to packages.element.io
uses: element-hq/packages.element.io@master
if: needs.linux.result == 'success'
if: needs.prepare.outputs.deploy && needs.linux.result == 'success'
with:
file: ${{ steps.deb.outputs.arm64 }}
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}

View file

@ -15,6 +15,11 @@ on:
required: false
default: false
description: "Whether the build is a Nightly and to calculate the version strings new builds should use"
deploy:
type: boolean
required: false
default: false
description: "Whether the build should be deployed to production"
secrets:
# Required if `nightly` is set
CF_R2_ACCESS_KEY_ID:
@ -29,10 +34,13 @@ on:
packages-dir:
description: "The directory non-deb packages for this run should live in within packages.element.io"
value: ${{ inputs.nightly && 'nightly' || 'desktop' }}
# This is just a simple pass-through of the input to simplify reuse of complex inline conditions
# These are just simple pass-throughs of the input to simplify reuse of complex inline conditions
config:
description: "The relative path to the config file for this run"
value: ${{ inputs.config }}
deploy:
description: "The relative path to the config file for this run"
value: ${{ inputs.deploy }}
jobs:
prepare:
name: Prepare