1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 04:56:12 +03:00

ci: automate making PR for flathub at release time

This commit is contained in:
Wez Furlong 2023-03-25 22:16:22 -07:00
parent 24ec8a0382
commit b99ecead8b
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
6 changed files with 217 additions and 4 deletions

View File

@ -125,3 +125,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: "bash ci/retry.sh gh release upload --clobber $(ci/tag-name.sh) wezterm-*.deb wezterm-*.xz *src.tar.gz *.AppImage *.zsync *.sha256"
- name: "Checkout flathub/org.wezfurlong.wezterm"
uses: actions/checkout@v3
with:
repository: "flathub/org.wezfurlong.wezterm"
path: "flathub"
token: "${{ secrets.GH_PAT }}"
- name: "Create flathub commit and push"
shell: bash
run: "bash ci/make-flathub-pr.sh"
- name: "Submit PR"
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
shell: bash
run: 'cd flathub && gh pr create --fill --body "PR automatically created by release automation in the wezterm repo"'

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<content_rating type="oars-1.0" />
<id>org.wezfurlong.wezterm</id>
<metadata_license>MIT</metadata_license>
<project_license>MIT</project_license>
<name>Wez's Terminal Emulator</name>
<summary>A GPU-accelerated cross-platform terminal emulator and multiplexer</summary>
<description>
<p>
WezTerm is a terminal emulator with support for modern features such as
fonts with ligatures, hyperlinks, multiple windows, tabs and split panes.
</p>
<p>
Configuration is expressed using Lua and many powerful functions are
provided to help you customize your terminal to your workflow.
</p>
<p>
Integrated ssh allows using multiple tabs and panes without requiring
tmux to be installed on the remote host, and remote wezterm multiplexer
support allows tmux+mosh style workflows without using tmux or mosh,
while providing a fully native GUI locally.
</p>
</description>
<launchable type="desktop-id">org.wezfurlong.wezterm.desktop</launchable>
<url type="homepage">https://wezfurlong.org/wezterm/</url>
<url type="help">https://wezfurlong.org/wezterm/help.html</url>
<url type="bugtracker">https://github.com/wez/wezterm/issues</url>
<url type="donation">https://github.com/sponsors/wez</url>
<screenshots>
<screenshot type="default">
<caption>Use background image attachments</caption>
<image>https://wezfurlong.org/wezterm/screenshots/wezterm-vday-screenshot.png</image>
</screenshot>
<screenshot>
<caption>Ligatures in VIM</caption>
<image>https://wezfurlong.org/wezterm/screenshots/two.png</image>
</screenshot>
<screenshot>
<caption>Multiple windows, tabs and panes are supported</caption>
<video>https://wezfurlong.org/wezterm/screenshots/wezterm-tabs.mp4</video>
</screenshot>
<screenshot>
<caption>Quickselect makes mouseless selection fast and convenient</caption>
<image>https://wezfurlong.org/wezterm/screenshots/wezterm-quick-select.png</image>
</screenshot>
<screenshot>
<caption>Dynamically change color schemes via escape sequences</caption>
<video>https://wezfurlong.org/wezterm/screenshots/wezterm-dynamic-colors.mp4</video>
</screenshot>
<screenshot>
<caption>Use gradients as background image attachments</caption>
<image>https://wezfurlong.org/wezterm/screenshots/radial-gradient.png</image>
</screenshot>
<screenshot>
<caption>Compose multiple background layers with parallax scrolling</caption>
<video>https://wezfurlong.org/wezterm/screenshots/wezterm-parallax-2.mp4</video>
</screenshot>
</screenshots>
<developer_name>Wez Furlong</developer_name>
<releases>
<release version="@TAG_NAME@" date="@DATE@">
<description>
<p>
A very long list of improvements to performance and
resource utilization as well as new features.
The changelog has a complete list!
</p>
</description>
</release>
</releases>
</component>

View File

@ -0,0 +1,60 @@
{
"app-id": "org.wezfurlong.wezterm",
"runtime": "org.freedesktop.Platform",
"runtime-version": "21.08",
"sdk": "org.freedesktop.Sdk",
"sdk-extensions" : [
"org.freedesktop.Sdk.Extension.rust-stable"
],
"command": "wezterm",
"finish-args": [
"--share=ipc",
"--filesystem=home:ro",
"--filesystem=xdg-config/wezterm",
"--socket=fallback-x11",
"--socket=wayland",
"--device=dri",
"--talk-name=org.freedesktop.Flatpak",
"--talk-name=org.freedesktop.Notifications",
"--share=network"
],
"modules": [
{
"name": "wezterm",
"buildsystem": "simple",
"build-options": {
"append-path" : "/usr/lib/sdk/rust-stable/bin",
"env": {
"CARGO_HOME": "/run/build/wezterm/cargo"
}
},
"build-commands": [
"cargo --offline fetch --manifest-path Cargo.toml --verbose",
"cargo --offline build --release --verbose",
"install -Dm644 ./assets/icon/terminal.png /app/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png",
"install -Dm644 org.wezfurlong.wezterm.appdata.xml /app/share/metainfo/org.wezfurlong.wezterm.appdata.xml",
"install -Dm644 ./assets/wezterm.desktop /app/share/applications/org.wezfurlong.wezterm.desktop",
"install -Dm755 ./target/release/wezterm -t /app/bin/",
"install -Dm755 ./target/release/wezterm-gui -t /app/bin/",
"install -Dm755 ./target/release/wezterm-mux-server -t /app/bin/",
"install -Dm755 ./target/release/strip-ansi-escapes -t /app/bin/",
"install -Dm644 assets/shell-integration/* -t /app/extra/export/share/etc/profile.d",
"install -Dm644 assets/shell-completion/zsh /app/extra/export/share/zsh/site-functions/_wezterm",
"install -Dm644 assets/shell-completion/bash /app/extra/export/share/etc/bash_completion.d/wezterm"
],
"sources": [
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "@URL@",
"sha256": "@SHA256@"
},
{
"type": "file",
"path": "org.wezfurlong.wezterm.appdata.xml"
},
"generated-sources.json"
]
}
]
}

View File

@ -10,4 +10,11 @@ flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validat
python3 -m pip install toml aiohttp
curl -L 'https://github.com/flatpak/flatpak-builder-tools/raw/master/cargo/flatpak-cargo-generator.py' > /tmp/flatpak-cargo-generator.py
python3 /tmp/flatpak-cargo-generator.py Cargo.lock -o assets/flatpak/generated-sources.json
flatpak-builder --state-dir /var/tmp/wezterm-flatpak-builder --install /var/tmp/wezterm-flatpak-repo assets/flatpak/org.wezfurlong.wezterm.json --force-clean --user -y
if [ "${CI}" != "yes" ] ; then
flatpak-builder \
--state-dir /var/tmp/wezterm-flatpak-builder \
--install /var/tmp/wezterm-flatpak-repo \
assets/flatpak/org.wezfurlong.wezterm.json \
--force-clean --user -y
fi

View File

@ -149,7 +149,7 @@ class InstallCrateStep(ActionStep):
super().__init__(
f"Install {crate} from Cargo",
action="baptiste0928/cargo-install@v2",
params=params
params=params,
)
@ -451,7 +451,6 @@ cargo build --all --release""",
run=run,
),
]
def package(self, trusted=False):
steps = []
@ -639,6 +638,32 @@ cargo build --all --release""",
),
]
def create_flathub_pr(self):
if not self.app_image:
return []
return [
ActionStep(
"Checkout flathub/org.wezfurlong.wezterm",
action="actions/checkout@v3",
params={
"repository": "flathub/org.wezfurlong.wezterm",
"path": "flathub",
"token": "${{ secrets.GH_PAT }}",
},
),
RunStep(
"Create flathub commit and push",
"bash ci/make-flathub-pr.sh",
),
RunStep(
"Submit PR",
'cd flathub && gh pr create --fill --body "PR automatically created by release automation in the wezterm repo"',
env={
"GITHUB_TOKEN": "${{ secrets.GH_PAT }}",
},
),
]
def create_winget_pr(self):
steps = []
if "windows" in self.name:
@ -885,7 +910,8 @@ cargo build --all --release""",
runs_on="ubuntu-latest",
steps=self.checkout(submodules=False)
+ self.upload_asset_tag()
+ self.create_winget_pr(),
+ self.create_winget_pr()
+ self.create_flathub_pr(),
)
return (

27
ci/make-flathub-pr.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
set -xe
TAG_NAME=$(ci/tag-name.sh)
python3 -m pip install toml aiohttp
curl -L 'https://github.com/flatpak/flatpak-builder-tools/raw/master/cargo/flatpak-cargo-generator.py' > /tmp/flatpak-cargo-generator.py
python3 /tmp/flatpak-cargo-generator.py Cargo.lock -o flathub/generated-sources.json
URL="https://github.com/wez/wezterm/releases/download/${TAG_NAME}/wezterm-${TAG_NAME}-src.tar.gz"
# We require that something has obtained the source archive already and left it
# in the current dir. This is handled by actions/download-artifact in CI
SHA256=$(sha256sum wezterm*-src.tar.gz | cut -d' ' -f1)
sed -e "s,@URL@,$URL,g" -e "s/@SHA256@/$SHA256/g" < assets/flatpak/org.wezfurlong.wezterm.template.json > flathub/org.wezfurlong.wezterm.json
RELEASE_DATE=$(git -c "core.abbrev=8" show -s "--format=%cd" "--date=format:%Y-%m-%d")
sed -e "s,@TAG_NAME@,$TAG_NAME,g" -e "s/@DATE@/$RELEASE_DATE/g" < assets/flatpak/org.wezfurlong.wezterm.appdata.template.xml > flathub/org.wezfurlong.wezterm.appdata.xml
cd flathub
git config user.email wez@wezfurlong.org
git config user.name 'Wez Furlong'
git checkout -b "$TAG_NAME" origin/master
git add --all
git diff --cached
git commit -m "New version: $TAG_NAME"
git push --set-upstream origin "$TAG_NAME" --quiet