Skip to content

Commit

Permalink
fix: github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRuen committed Oct 28, 2024
1 parent e0fc1f1 commit 686d426
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/publish-to-nextcloud.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: Build and publish app release
name: Publish to Nextcloud store

on:
release:
types: [published]
workflow_run:
workflows: ["Build and Release"]
types:
- completed

env:
APP_NAME: news
APP_NAME: cidgravity_gateway

jobs:
build_and_publish:
publish_to_nextcloud_store:
environment: release
runs-on: ubuntu-latest
name: "Release: build, sign and upload the app"
strategy:
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app_name=cidgravity_gateway
project_dir=$(CURDIR)/../$(app_name)
project_dir=$(CURDIR)
build_dir=$(CURDIR)/build/artifacts
appstore_dir=$(build_dir)/appstore
source_dir=$(build_dir)/source
Expand Down Expand Up @@ -85,6 +85,10 @@ appstore:
--exclude=vendor \
--exclude=webpack.*.js \
$(project_dir)/ $(sign_dir)/$(app_name)

php ./bin/tools/file_from_env.php "APP_PRIVATE_KEY" "$(cert_dir)/$(app_name).key"
php ./bin/tools/file_from_env.php "APP_PUBLIC_CRT" "$(cert_dir)/$(app_name).crt"

@if [ -f $(cert_dir)/$(app_name).key ]; then \
echo "Signing app files…"; \
php ../../occ integrity:sign-app \
Expand Down
29 changes: 29 additions & 0 deletions bin/tools/file_from_env.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
/**
* Nextcloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Benjamin Brahmer <[email protected]>
* @copyright Benjamin Brahmer 2020
*/

if ($argc < 2) {
echo "This script expects two parameters:\n";
echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n";
exit(1);
}

# Read environment variable
$content = getenv($argv[1]);

if (!$content){
echo "Variable was empty\n";
exit(1);
}

file_put_contents($argv[2], $content);

echo "Done...\n";

0 comments on commit 686d426

Please sign in to comment.