diff --git a/.github/workflows/build_and_deploy.yaml b/.github/workflows/build_and_deploy.yaml index 6cfebc6..b18fc26 100644 --- a/.github/workflows/build_and_deploy.yaml +++ b/.github/workflows/build_and_deploy.yaml @@ -3,6 +3,9 @@ on: # Nightly build schedule: - cron: "0 9 * * *" + # Release build + release: + types: [published] # Manual nightly & release workflow_dispatch: inputs: @@ -42,9 +45,9 @@ jobs: prepare: uses: ./.github/workflows/build_prepare.yaml with: - config: element.io/${{ inputs.mode || 'nightly' }} - version: ${{ inputs.mode != 'release' && 'develop' || '' }} - nightly: ${{ inputs.mode != 'release' }} + 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' }} secrets: CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} CF_R2_TOKEN: ${{ secrets.CF_R2_TOKEN }} @@ -73,7 +76,7 @@ jobs: with: sign: true deploy-mode: true - base-url: https://packages.element.io/${{ inputs.mode == 'release' && 'desktop' || 'nightly' }} + base-url: https://packages.element.io/${{ needs.prepare.outputs.packages-dir }} version: ${{ needs.prepare.outputs.nightly-version }} # We do not put these calls into deploy-mode as we do not want it to add to the packages.element.io artifact @@ -88,7 +91,7 @@ jobs: uses: ./.github/workflows/build_linux.yaml with: arch: ${{ matrix.arch }} - config: element.io/${{ inputs.mode || 'nightly' }} + config: ${{ needs.prepare.outputs.config }} sqlcipher: system version: ${{ needs.prepare.outputs.nightly-version }} @@ -101,7 +104,7 @@ jobs: with: arch: amd64 deploy-mode: true - config: element.io/${{ inputs.mode || 'nightly' }} + config: ${{ needs.prepare.outputs.config }} sqlcipher: static version: ${{ needs.prepare.outputs.nightly-version }} @@ -109,6 +112,7 @@ jobs: # Linux will be deployed via reprepro after it, but we list it as a dependency to abort if it fails. deploy: needs: + - prepare - macos - linux - linux_static @@ -116,7 +120,10 @@ jobs: runs-on: ubuntu-latest name: Deploy if: | - github.event_name != 'workflow_dispatch' || ( + ( + github.event_name != 'workflow_dispatch' && + github.event.release.prerelease != true + ) || ( always() && !failure() && !cancelled() && inputs.deploy && (inputs.macos || inputs.windows || inputs.linux) ) @@ -135,7 +142,7 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }} R2_URL: ${{ vars.CF_R2_S3_API }} - DEPLOYMENT_DIR: ${{ inputs.mode == 'release' && 'desktop' || 'nightly' }} + DEPLOYMENT_DIR: ${{ needs.prepare.outputs.packages-dir }} - name: Notify packages.element.io of new files uses: peter-evans/repository-dispatch@26b39ed245ab8f31526069329e112ab2fb224588 # v2 @@ -154,7 +161,10 @@ jobs: matrix: arch: [amd64, arm64] if: | - github.event_name != 'workflow_dispatch' || ( + ( + github.event_name != 'workflow_dispatch' && + github.event.release.prerelease != true + ) || ( always() && !failure() && !cancelled() && inputs.deploy && inputs.linux ) uses: ./.github/workflows/reprepro.yaml diff --git a/.github/workflows/build_prepare.yaml b/.github/workflows/build_prepare.yaml index 3854ea6..69e8269 100644 --- a/.github/workflows/build_prepare.yaml +++ b/.github/workflows/build_prepare.yaml @@ -26,6 +26,13 @@ on: nightly-version: description: "The version string the next Nightly should use, only output for nightly" value: ${{ jobs.prepare.outputs.nightly-version }} + 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 + config: + description: "The relative path to the config file for this run" + value: ${{ inputs.config }} jobs: prepare: name: Prepare