2023-08-02 15:40:40 +02:00
|
|
|
name: Build Debian package
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
concurrency: ${{ github.workflow }}
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build package
|
|
|
|
environment: packages.element.io
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
R2_INCOMING_BUCKET: ${{ vars.R2_INCOMING_BUCKET }}
|
|
|
|
R2_URL: ${{ vars.CF_R2_S3_API }}
|
2023-10-25 15:39:44 +02:00
|
|
|
VERSION: ${{ github.ref_name }}
|
2023-08-02 15:40:40 +02:00
|
|
|
steps:
|
2023-09-05 19:31:32 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-08-02 15:40:40 +02:00
|
|
|
|
2023-10-25 15:39:44 +02:00
|
|
|
- name: Download package
|
|
|
|
run: |
|
2023-12-12 11:31:44 +01:00
|
|
|
wget "https://github.com/element-hq/element-web/releases/download/$VERSION/element-$VERSION.tar.gz"
|
|
|
|
wget "https://github.com/element-hq/element-web/releases/download/$VERSION/element-$VERSION.tar.gz.asc"
|
2023-10-25 15:39:44 +02:00
|
|
|
|
|
|
|
- name: Check GPG signature
|
|
|
|
run: |
|
|
|
|
wget "https://packages.element.io/element-release-key.gpg"
|
|
|
|
gpg --import element-release-key.gpg
|
|
|
|
gpg --fingerprint "$FINGERPRINT"
|
|
|
|
gpg --verify "element-$VERSION.tar.gz.asc" "element-$VERSION.tar.gz"
|
|
|
|
env:
|
|
|
|
FINGERPRINT: ${{ vars.GPG_FINGERPRINT }}
|
|
|
|
|
2023-08-02 15:40:40 +02:00
|
|
|
- name: Prepare
|
|
|
|
run: |
|
2023-11-09 10:56:26 +01:00
|
|
|
mkdir -p debian/tmp/DEBIAN
|
|
|
|
find debian -maxdepth 1 -type f -exec cp "{}" debian/tmp/DEBIAN/ \;
|
2023-11-21 17:28:28 +01:00
|
|
|
mkdir -p debian/tmp/usr/share/element-web/ debian/tmp/etc/element-web/
|
2023-08-02 15:40:40 +02:00
|
|
|
|
2023-11-09 10:56:26 +01:00
|
|
|
tar -xf "element-$VERSION.tar.gz" -C debian/tmp/usr/share/element-web --strip-components=1 --no-same-owner --no-same-permissions
|
2023-11-21 17:28:28 +01:00
|
|
|
mv debian/tmp/usr/share/element-web/config.sample.json debian/tmp/etc/element-web/config.json
|
|
|
|
ln -s /etc/element-web/config.json debian/tmp/usr/share/element-web/config.json
|
2023-11-09 10:56:26 +01:00
|
|
|
|
|
|
|
- name: Write changelog
|
|
|
|
run: |
|
|
|
|
VERSION=$(cat package.json | jq -r .version)
|
|
|
|
TIME=$(date -d "$PUBLISHED_AT" -R)
|
|
|
|
{
|
|
|
|
echo "element-web ($VERSION) default; urgency=medium"
|
|
|
|
echo "$BODY" | sed 's/^##/\n */g;s/^\*/ */g' | perl -pe 's/\[.+?]\((.+?)\)/\1/g'
|
|
|
|
echo ""
|
|
|
|
echo " -- $ACTOR <support@element.io> $TIME"
|
|
|
|
} > debian/tmp/DEBIAN/changelog
|
|
|
|
env:
|
|
|
|
ACTOR: ${{ github.actor }}
|
|
|
|
VERSION: ${{ github.event.release.tag_name }}
|
|
|
|
BODY: ${{ github.event.release.body }}
|
|
|
|
PUBLISHED_AT: ${{ github.event.release.published_at }}
|
2023-08-02 15:40:40 +02:00
|
|
|
|
|
|
|
- name: Build deb package
|
|
|
|
run: |
|
|
|
|
VERSION=$(cat package.json | jq -r .version)
|
2023-11-09 10:56:26 +01:00
|
|
|
dpkg-gencontrol -v"$VERSION" -ldebian/tmp/DEBIAN/changelog
|
|
|
|
dpkg-deb -Zxz --root-owner-group --build debian/tmp element-web.deb
|
2023-08-02 15:40:40 +02:00
|
|
|
|
2024-01-19 09:54:43 +01:00
|
|
|
- uses: actions/upload-artifact@v4
|
2023-08-02 15:40:40 +02:00
|
|
|
with:
|
2023-11-09 10:56:26 +01:00
|
|
|
name: element-web.deb
|
|
|
|
path: element-web.deb
|
2023-08-02 15:40:40 +02:00
|
|
|
retention-days: 14
|
|
|
|
|
2023-11-09 10:56:26 +01:00
|
|
|
- name: Publish to packages.element.io
|
|
|
|
if: github.event.release.prerelease == false
|
2023-12-12 11:31:44 +01:00
|
|
|
uses: element-hq/packages.element.io@master
|
2023-11-09 10:56:26 +01:00
|
|
|
with:
|
|
|
|
file: element-web.deb
|
|
|
|
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
|
|
|
bucket-api: ${{ vars.CF_R2_S3_API }}
|
|
|
|
bucket-key-id: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
|
|
|
|
bucket-access-key: ${{ secrets.CF_R2_TOKEN }}
|