Skip to content

Commit 1cef01f

Browse files
committed
replace drone PR appimage setup with GitHub Actions
Signed-off-by: Jyrki Gadinger <[email protected]>
1 parent 34813d3 commit 1cef01f

File tree

4 files changed

+67
-182
lines changed

4 files changed

+67
-182
lines changed

.drone.yml

-22
Original file line numberDiff line numberDiff line change
@@ -148,28 +148,6 @@ trigger:
148148

149149
---
150150
kind: pipeline
151-
name: AppImage
152-
153-
steps:
154-
- name: build
155-
image: ghcr.io/nextcloud/continuous-integration-client-appimage-qt6:client-appimage-6.7.3-1
156-
environment:
157-
CI_UPLOAD_GIT_TOKEN:
158-
from_secret: CI_UPLOAD_GIT_TOKEN
159-
CI_UPLOAD_GIT_USERNAME:
160-
from_secret: CI_UPLOAD_GIT_USERNAME
161-
commands:
162-
- BUILDNR=$DRONE_BUILD_NUMBER VERSION_SUFFIX=$DRONE_PULL_REQUEST BUILD_UPDATER=ON DESKTOP_CLIENT_ROOT=$DRONE_WORKSPACE EXECUTABLE_NAME=nextcloud QT_BASE_DIR=/opt/qt6.7.3 OPENSSL_ROOT_DIR=/usr/local/lib64 /bin/bash -c "./admin/linux/build-appimage.sh"
163-
- BUILDNR=$DRONE_BUILD_NUMBER VERSION_SUFFIX=$DRONE_PULL_REQUEST DESKTOP_CLIENT_ROOT=$DRONE_WORKSPACE /bin/bash -c "./admin/linux/upload-appimage.sh" || echo "Upload failed, however this is an optional step."
164-
trigger:
165-
branch:
166-
- master
167-
- stable-*
168-
event:
169-
- pull_request
170-
- push
171-
---
172-
kind: pipeline
173151
name: Debian
174152

175153
steps:

.github/workflows/linux-appimage.yml

+55-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,61 @@ jobs:
1111
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 1
14+
1415
- name: Configure, compile and package
16+
id: build-appimage
17+
env:
18+
PR_ID: ${{ github.event.number }}
1519
run: |
1620
BUILDNR=${GITHUB_RUN_ID} VERSION_SUFFIX=${GITHUB_HEAD_REF} BUILD_UPDATER=ON DESKTOP_CLIENT_ROOT=`pwd` EXECUTABLE_NAME=nextcloud QT_BASE_DIR=/opt/qt OPENSSL_ROOT_DIR=/usr/local/lib64 /bin/bash -c "./admin/linux/build-appimage.sh"
17-
BUILDNR=${GITHUB_RUN_ID} VERSION_SUFFIX=${GITHUB_HEAD_REF} DESKTOP_CLIENT_ROOT=`pwd` /bin/bash -c "./admin/linux/upload-appimage.sh" || echo "Upload failed, however this is an optional step."
21+
22+
- name: Upload AppImage artifact
23+
id: upload-appimage
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: appimage-pr-${{ github.event.number }}
27+
path: ${{ steps.build-appimage.outputs.APPIMAGE_NAME }}
28+
overwrite: true
29+
30+
- name: Comment AppImage
31+
uses: actions/github-script@v7
32+
with:
33+
script: |
34+
const comment_identifier_string = "<!-- automated comment for an appimage build -->";
35+
36+
const comment_body = `
37+
${comment_identifier_string}
38+
39+
AppImage file: [${{ steps.build-appimage.outputs.APPIMAGE_NAME }}](${{ steps.upload-appimage.outputs.artifact-url }})
40+
41+
To test this change/fix you can simply download above AppImage file and test it.
42+
43+
Please make sure to quit your existing Nextcloud app and backup your data.
44+
`;
45+
46+
console.log("fetching old comments")
47+
const comments = await github.rest.issues.listComments({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
issue_number: context.issue.number,
51+
});
52+
53+
comments
54+
.data
55+
.filter(comment => comment.body?.includes(comment_identifier_string))
56+
.forEach(comment => {
57+
console.log(`deleting previous AppImage comment with ID ${comment.id}`)
58+
github.rest.issues.deleteComment({
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
comment_id: comment.id,
62+
})
63+
});
64+
65+
console.log("creating new comment")
66+
github.rest.issues.createComment({
67+
owner: context.repo.owner,
68+
repo: context.repo.repo,
69+
issue_number: context.issue.number,
70+
body: comment_body,
71+
});

admin/linux/build-appimage.sh

+12-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export OPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR:-/usr/lib/x86_64-linux-gnu}
1212
export VERSION_SUFFIX=${VERSION_SUFFIX:stable}
1313

1414
# Set defaults
15-
export SUFFIX=${DRONE_PULL_REQUEST:=master}
15+
export SUFFIX=${PR_ID:=${DRONE_PULL_REQUEST:=master}}
1616
if [ $SUFFIX != "master" ]; then
1717
SUFFIX="PR-$SUFFIX"
1818
fi
@@ -111,10 +111,17 @@ rm ./squashfs-root/usr/lib/libglib-2.0.so.0
111111
LD_LIBRARY_PATH="$PWD/appimagetool-squashfs-root/usr/lib":$LD_LIBRARY_PATH PATH="$PWD/appimagetool-squashfs-root/usr/bin":$PATH appimagetool -n ./squashfs-root "${APPIMAGE}"
112112

113113
#move AppImage
114-
if [ ! -z "$DRONE_COMMIT" ]
114+
export COMMIT=${GITHUB_SHA:=${DRONE_COMMIT}}
115+
if [ ! -z "$COMMIT" ]
115116
then
116-
mv *.AppImage ${EXECUTABLE_NAME}-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
117+
export APPIMAGE_NAME="${EXECUTABLE_NAME}-${SUFFIX}-${COMMIT}-x86_64.AppImage"
117118
else
118-
mv *.AppImage ${EXECUTABLE_NAME}-${SUFFIX}-x86_64.AppImage
119+
export APPIMAGE_NAME="${EXECUTABLE_NAME}-${SUFFIX}-x86_64.AppImage"
120+
fi
121+
mv *.AppImage ${DESKTOP_CLIENT_ROOT}/$APPIMAGE_NAME
122+
123+
# tell GitHub Actions the name of our appimage
124+
if [ ! -z "$GITHUB_OUTPUT" ]; then
125+
echo "AppImage name: ${APPIMAGE_NAME}"
126+
echo "APPIMAGE_NAME=${APPIMAGE_NAME}" >> "$GITHUB_OUTPUT"
119127
fi
120-
mv *.AppImage ${DESKTOP_CLIENT_ROOT}/

admin/linux/upload-appimage.sh

-154
This file was deleted.

0 commit comments

Comments
 (0)