Skip to content

Commit

Permalink
replace drone PR appimage setup with GitHub Actions
Browse files Browse the repository at this point in the history
Signed-off-by: Jyrki Gadinger <[email protected]>
  • Loading branch information
nilsding committed Jan 23, 2025
1 parent 34813d3 commit 1cef01f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 182 deletions.
22 changes: 0 additions & 22 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,28 +148,6 @@ trigger:

---
kind: pipeline
name: AppImage

steps:
- name: build
image: ghcr.io/nextcloud/continuous-integration-client-appimage-qt6:client-appimage-6.7.3-1
environment:
CI_UPLOAD_GIT_TOKEN:
from_secret: CI_UPLOAD_GIT_TOKEN
CI_UPLOAD_GIT_USERNAME:
from_secret: CI_UPLOAD_GIT_USERNAME
commands:
- 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"
- 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."
trigger:
branch:
- master
- stable-*
event:
- pull_request
- push
---
kind: pipeline
name: Debian

steps:
Expand Down
56 changes: 55 additions & 1 deletion .github/workflows/linux-appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,61 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Configure, compile and package
id: build-appimage
env:
PR_ID: ${{ github.event.number }}
run: |
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"
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."
- name: Upload AppImage artifact
id: upload-appimage
uses: actions/upload-artifact@v4
with:
name: appimage-pr-${{ github.event.number }}
path: ${{ steps.build-appimage.outputs.APPIMAGE_NAME }}
overwrite: true

- name: Comment AppImage
uses: actions/github-script@v7
with:
script: |
const comment_identifier_string = "<!-- automated comment for an appimage build -->";
const comment_body = `
${comment_identifier_string}
AppImage file: [${{ steps.build-appimage.outputs.APPIMAGE_NAME }}](${{ steps.upload-appimage.outputs.artifact-url }})
To test this change/fix you can simply download above AppImage file and test it.
Please make sure to quit your existing Nextcloud app and backup your data.
`;
console.log("fetching old comments")
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
comments
.data
.filter(comment => comment.body?.includes(comment_identifier_string))
.forEach(comment => {
console.log(`deleting previous AppImage comment with ID ${comment.id}`)
github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
})
});
console.log("creating new comment")
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment_body,
});
17 changes: 12 additions & 5 deletions admin/linux/build-appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export OPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR:-/usr/lib/x86_64-linux-gnu}
export VERSION_SUFFIX=${VERSION_SUFFIX:stable}

# Set defaults
export SUFFIX=${DRONE_PULL_REQUEST:=master}
export SUFFIX=${PR_ID:=${DRONE_PULL_REQUEST:=master}}
if [ $SUFFIX != "master" ]; then
SUFFIX="PR-$SUFFIX"
fi
Expand Down Expand Up @@ -111,10 +111,17 @@ rm ./squashfs-root/usr/lib/libglib-2.0.so.0
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}"

#move AppImage
if [ ! -z "$DRONE_COMMIT" ]
export COMMIT=${GITHUB_SHA:=${DRONE_COMMIT}}
if [ ! -z "$COMMIT" ]
then
mv *.AppImage ${EXECUTABLE_NAME}-${SUFFIX}-${DRONE_COMMIT}-x86_64.AppImage
export APPIMAGE_NAME="${EXECUTABLE_NAME}-${SUFFIX}-${COMMIT}-x86_64.AppImage"
else
mv *.AppImage ${EXECUTABLE_NAME}-${SUFFIX}-x86_64.AppImage
export APPIMAGE_NAME="${EXECUTABLE_NAME}-${SUFFIX}-x86_64.AppImage"
fi
mv *.AppImage ${DESKTOP_CLIENT_ROOT}/$APPIMAGE_NAME

# tell GitHub Actions the name of our appimage
if [ ! -z "$GITHUB_OUTPUT" ]; then
echo "AppImage name: ${APPIMAGE_NAME}"
echo "APPIMAGE_NAME=${APPIMAGE_NAME}" >> "$GITHUB_OUTPUT"
fi
mv *.AppImage ${DESKTOP_CLIENT_ROOT}/
154 changes: 0 additions & 154 deletions admin/linux/upload-appimage.sh

This file was deleted.

0 comments on commit 1cef01f

Please sign in to comment.