Skip to content

Commit

Permalink
fix: Release automation
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Feb 26, 2025
1 parent ff05020 commit 6a941c9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/appstore-conventional-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -35,9 +34,11 @@ jobs:

- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@b7f32a8347e86c26ea2f4823cc7c160b9014c6a0 # v3
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.RELEASE_PAT }}
git-user-email: [email protected]
git-user-name: Nextcloud Command Bot
skip-git-pull: "true"
pre-commit: build/pre-commit.js
release-count: 0
Expand All @@ -61,15 +62,15 @@ jobs:
fallbackNpm: '^9'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Set up php ${{ env.PHP_VERSION }}
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2
uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
Expand All @@ -81,15 +82,15 @@ jobs:
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 }} ${{ env.APP_VERSION }} with krankerl
- name: Package ${{ env.APP_NAME }} ${{ steps.changelog.outputs.tag }} with krankerl
run: krankerl package

- name: Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
continue-on-error: true
id: server-checkout
run: |
NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip -O build/nextcloud.zip
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
Expand All @@ -107,8 +108,8 @@ jobs:
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
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt" -O build/${{ env.APP_NAME }}.crt
pwd
ls -l
ls -l build
Expand All @@ -132,7 +133,7 @@ jobs:
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 }}-${{ env.APP_VERSION }}.tar.gz
asset_name: ${{ env.APP_NAME }}-${{ steps.changelog.outputs.tag }}.tar.gz
tag: ${{ steps.changelog.outputs.tag }}
overwrite: true

Expand Down
14 changes: 14 additions & 0 deletions build/pre-commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

const fs = require('fs')

exports.preCommit = (props) => {
const old = fs.readFileSync('appinfo/info.xml').toString('utf-8')

const updated = old.replace(/<version>(.+?)<\/version>/, '<version>' + props.version + '</version>')

fs.writeFileSync('appinfo/info.xml', updated)
}

0 comments on commit 6a941c9

Please sign in to comment.