Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 30 additions & 104 deletions .github/workflows/appstore-conventional-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,28 @@
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021-2025 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Build and publish app release conventionally

on:
workflow_dispatch:
branches: stable*
inputs:
prerelease:
description: 'Pre-release'
type: boolean
required: true
prereleaseIdentifier:
description: 'Pre-release identifier'
required: true
default: 'rc'
type: choice
options:
- alpha
- beta
- rc

env:
PHP_VERSION: 8.2
Expand All @@ -30,6 +44,7 @@ jobs:
run: |
# Split and keep last
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -39,7 +54,7 @@ jobs:

- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@67139193614f5b9e8db87da1bd4240922b34d765 # v6
uses: TriPSs/conventional-changelog-action@b7f32a8347e86c26ea2f4823cc7c160b9014c6a0 # v3
with:
github-token: ${{ secrets.RELEASE_PAT }}
git-user-email: nextcloud-command@users.noreply.github.com
Expand All @@ -48,114 +63,25 @@ jobs:
pre-commit: build/pre-commit.cjs
release-count: 0
version-file: "package.json, package-lock.json"

- name: Get appinfo data
id: appinfo
uses: skjnldsv/xpath-action@f5b036e9d973f42c86324833fd00be90665fbf77 # master
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
filename: appinfo/info.xml
expression: "//info//dependencies//nextcloud/@min-version"

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
if: ${{ steps.changelog.outputs.skipped == 'false' }}
id: versions
# Continue if no package.json
continue-on-error: true
with:
path: ./
fallbackNode: '^20'
fallbackNpm: '^9'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Set up php ${{ env.PHP_VERSION }}
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Krankerl
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb
sudo dpkg -i krankerl_0.14.0_amd64.deb

- name: Package ${{ env.APP_NAME }} ${{ steps.changelog.outputs.tag }} with krankerl
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: krankerl package

- name: Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
if: ${{ steps.changelog.outputs.skipped == 'false' }}
continue-on-error: true
id: server-checkout
run: |
NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
wget https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip -O build/nextcloud.zip
unzip build/nextcloud.zip build/nextcloud

- name: Checkout server master fallback
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: ${{ steps.changelog.outputs.skipped == 'false' && steps.server-checkout.outcome != 'success' }}
with:
submodules: true
repository: nextcloud/server
path: build/nextcloud

- name: Sign app
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
# Extracting release
cd build/artifacts
tar -xvf ${{ env.APP_NAME }}.tar.gz
cd ../../
# Setting up keys
echo "${{ secrets.APP_CERT }}" > build/${{ env.APP_NAME }}.crt
echo "${{ secrets.APP_PRIVATE_KEY }}" > build/${{ env.APP_NAME }}.key
pwd
ls -l
ls -l build
# Signing
php build/nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../artifacts/${{ env.APP_NAME }}
# Rebuilding archive
cd build/artifacts
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
pre-release: ${{ inputs.prerelease }}
pre-release-identifier: ${{ inputs.prereleaseIdentifier }}

- name: Push tag to releases organization
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
git remote add release https://github.com/nextcloud-releases/${{ env.APP_NAME }}.git
git push release ${{ steps.changelog.outputs.tag }}

- name: Attach tarball to github release
- name: Create Release
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
id: attach_to_release
with:
repo_token: ${{ secrets.RELEASE_PAT }}
repo_name: nextcloud-releases/${{ env.APP_NAME }}
file: build/artifacts/${{ env.APP_NAME }}.tar.gz
asset_name: ${{ env.APP_NAME }}-${{ steps.changelog.outputs.tag }}.tar.gz
tag: ${{ steps.changelog.outputs.tag }}
overwrite: true

- name: Upload app to Nextcloud appstore
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1
id: create_release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
with:
app_name: ${{ env.APP_NAME }}
appstore_token: ${{ secrets.APPSTORE_TOKEN }}
download_url: ${{ steps.attach_to_release.outputs.browser_download_url }}
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
owner: nextcloud-releases
repo: ${{ env.APP_NAME }}
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
prerelease: ${{ inputs.prerelease }}
Loading