2023-01-31 14:22:30 +01:00
|
|
|
# This action helps perform common actions before the build_* actions are started in parallel.
|
2022-11-11 16:15:21 +01:00
|
|
|
on:
|
2022-12-15 12:00:58 +01:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
config:
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
description: "The config directory to use"
|
|
|
|
version:
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
description: "The version tag to fetch, or 'develop', will pick automatically if not passed"
|
2023-03-07 16:53:53 +01:00
|
|
|
nightly:
|
|
|
|
type: boolean
|
2023-01-31 14:22:30 +01:00
|
|
|
required: false
|
2023-03-07 16:53:53 +01:00
|
|
|
default: false
|
|
|
|
description: "Whether the build is a Nightly and to calculate the version strings new builds should use"
|
2023-01-31 14:22:30 +01:00
|
|
|
secrets:
|
2023-03-07 16:53:53 +01:00
|
|
|
# Required if `nightly` is set
|
2023-01-31 14:22:30 +01:00
|
|
|
CF_R2_ACCESS_KEY_ID:
|
|
|
|
required: false
|
2023-03-07 16:53:53 +01:00
|
|
|
# Required if `nightly` is set
|
2023-01-31 14:22:30 +01:00
|
|
|
CF_R2_TOKEN:
|
|
|
|
required: false
|
2023-03-07 16:53:53 +01:00
|
|
|
# Required if `nightly` is set
|
2023-01-31 14:22:30 +01:00
|
|
|
CF_R2_S3_API:
|
|
|
|
required: false
|
|
|
|
outputs:
|
|
|
|
macos-version:
|
2023-03-07 16:53:53 +01:00
|
|
|
description: "The version string the next macOS Nightly should use, only output for nightly"
|
2023-01-31 14:22:30 +01:00
|
|
|
value: ${{ jobs.prepare.outputs.macos-version }}
|
2023-02-20 13:09:45 +01:00
|
|
|
linux-version:
|
2023-03-07 16:53:53 +01:00
|
|
|
description: "The version string the next Linux Nightly should use, only output for nightly"
|
2023-02-20 13:09:45 +01:00
|
|
|
value: ${{ jobs.prepare.outputs.linux-version }}
|
2023-02-22 14:51:19 +01:00
|
|
|
win32-x64-version:
|
2023-03-07 16:53:53 +01:00
|
|
|
description: "The version string the next Windows x64 Nightly should use, only output for nightly"
|
2023-02-22 14:51:19 +01:00
|
|
|
value: ${{ jobs.prepare.outputs.win32-x64-version }}
|
|
|
|
win32-x86-version:
|
2023-03-07 16:53:53 +01:00
|
|
|
description: "The version string the next Windows x86 Nightly should use, only output for nightly"
|
2023-02-22 14:51:19 +01:00
|
|
|
value: ${{ jobs.prepare.outputs.win32-x86-version }}
|
2022-11-11 16:15:21 +01:00
|
|
|
jobs:
|
2022-12-15 12:00:58 +01:00
|
|
|
prepare:
|
|
|
|
name: Prepare
|
2023-03-07 16:53:53 +01:00
|
|
|
environment: ${{ inputs.nightly && 'packages.element.io' || '' }}
|
2022-12-15 12:00:58 +01:00
|
|
|
runs-on: ubuntu-latest
|
2023-01-31 14:22:30 +01:00
|
|
|
outputs:
|
2023-02-20 13:09:45 +01:00
|
|
|
macos-version: ${{ steps.versions.outputs.macos }}
|
|
|
|
linux-version: ${{ steps.versions.outputs.linux }}
|
2023-02-22 14:51:19 +01:00
|
|
|
win32-x64-version: ${{ steps.versions.outputs.win_x64 }}
|
|
|
|
win32-x86-version: ${{ steps.versions.outputs.win_x86 }}
|
2022-12-15 12:00:58 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
cache: "yarn"
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Install Deps
|
|
|
|
run: "yarn install --pure-lockfile"
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
- name: Fetch Element Web
|
|
|
|
run: yarn run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
|
2022-11-11 16:15:21 +01:00
|
|
|
|
2022-12-15 12:00:58 +01:00
|
|
|
# We split this out to save the build_* scripts having to do it to make use of `hashFiles` in the cache action
|
|
|
|
- name: Generate cache hash files
|
|
|
|
run: |
|
|
|
|
yarn run --silent electron --version > electronVersion
|
|
|
|
cat package.json | jq -c .hakDependencies > hakDependencies.json
|
2022-12-13 15:12:40 +01:00
|
|
|
|
2023-03-07 16:53:53 +01:00
|
|
|
- name: "[Nightly] Calculate versions"
|
2023-02-20 13:09:45 +01:00
|
|
|
id: versions
|
2023-03-07 16:53:53 +01:00
|
|
|
if: inputs.nightly
|
2023-01-31 14:22:30 +01:00
|
|
|
run: |
|
2023-02-20 13:09:45 +01:00
|
|
|
MACOS=$(aws s3 cp s3://$R2_BUCKET/nightly/update/macos/releases.json - --endpoint-url $R2_URL --region auto | jq -r .currentRelease)
|
|
|
|
echo "macos=$(scripts/generate-nightly-version.ts --latest $MACOS)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
LINUX=$(aws s3 cp s3://$R2_BUCKET/debian/dists/default/main/binary-amd64/Packages - --endpoint-url $R2_URL --region auto | grep "Package: element-nightly" -A 50 | grep Version -m1 | sed -n 's/Version: //p')
|
|
|
|
echo "linux=$(scripts/generate-nightly-version.ts --latest $LINUX)" >> $GITHUB_OUTPUT
|
2023-02-22 14:51:19 +01:00
|
|
|
|
|
|
|
WINx64=$(aws s3 cp s3://$R2_BUCKET/nightly/update/win32/x64/RELEASES - --endpoint-url $R2_URL --region auto | awk '{print $2}' | cut -d "-" -f 5 | cut -c 8-)
|
|
|
|
echo "win_x64=$(scripts/generate-nightly-version.ts --latest $WINx64)" >> $GITHUB_OUTPUT
|
|
|
|
WINx86=$(aws s3 cp s3://$R2_BUCKET/nightly/update/win32/ia32/RELEASES - --endpoint-url $R2_URL --region auto | awk '{print $2}' | cut -d "-" -f 5 | cut -c 8-)
|
|
|
|
echo "win_x86=$(scripts/generate-nightly-version.ts --latest $WINx86)" >> $GITHUB_OUTPUT
|
2023-01-31 14:22:30 +01:00
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }}
|
2023-03-23 16:17:07 +01:00
|
|
|
R2_BUCKET: "packages-element-io"
|
2023-01-31 14:22:30 +01:00
|
|
|
R2_URL: ${{ secrets.CF_R2_S3_API }}
|
2023-03-07 16:53:53 +01:00
|
|
|
|
|
|
|
- name: Check version
|
|
|
|
id: package
|
|
|
|
run: |
|
|
|
|
echo "version=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: "[Release] Fetch release"
|
|
|
|
id: release
|
|
|
|
if: ${{ !inputs.nightly && inputs.version != 'develop' }}
|
|
|
|
uses: cardinalby/git-get-release-action@cedef2faf69cb7c55b285bad07688d04430b7ada # v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
with:
|
|
|
|
tag: v${{ steps.package.outputs.version }}
|
|
|
|
|
|
|
|
- name: "[Release] Write changelog"
|
|
|
|
if: ${{ !inputs.nightly && inputs.version != 'develop' }}
|
|
|
|
run: |
|
|
|
|
TIME=$(date -d "$PUBLISHED_AT" -R)
|
|
|
|
echo "element-desktop ($VERSION) default; urgency=medium" >> changelog.Debian
|
|
|
|
echo "$BODY" | sed 's/^##/\n */g;s/^\*/ */g' | perl -pe 's/\[.+?]\((.+?)\)/\1/g' >> changelog.Debian
|
|
|
|
echo "" >> changelog.Debian
|
|
|
|
echo " -- ${{ github.actor }} <support@element.io> $TIME" >> changelog.Debian
|
|
|
|
env:
|
|
|
|
VERSION: v${{ steps.package.outputs.version }}
|
|
|
|
BODY: ${{ steps.release.outputs.body }}
|
|
|
|
PUBLISHED_AT: ${{ steps.release.outputs.published_at }}
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: webapp
|
|
|
|
retention-days: 1
|
|
|
|
path: |
|
|
|
|
webapp.asar
|
|
|
|
package.json
|
|
|
|
electronVersion
|
|
|
|
hakDependencies.json
|
|
|
|
changelog.Debian
|