Skip to content

Commit

Permalink
Merge pull request #100 from LibreSign/feature-publish-app
Browse files Browse the repository at this point in the history
Feature publish app
  • Loading branch information
vitormattos authored Mar 8, 2021
2 parents 53aedf7 + a8bffcc commit c606d53
Show file tree
Hide file tree
Showing 4 changed files with 409 additions and 48 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and publish app release

on:
release:
types: [published]

env:
APP_NAME: libresign

jobs:
build_and_publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ env.APP_NAME }}
- name: Run build
run: cd ${{ env.APP_NAME }} && make appstore
- name: Upload app tarball to release
uses: svenstaro/upload-release-action@v2
id: attach_to_release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.APP_NAME }}/build/artifacts/appstore/${{ env.APP_NAME }}.tar.gz
asset_name: ${{ env.APP_NAME }}.tar.gz
tag: ${{ github.ref }}
overwrite: true
- name: Upload app to Nextcloud appstore
uses: R0Wi/nextcloud-appstore-push-action@v1
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 }}
nightly: ${{ github.event.release.prerelease }}
46 changes: 34 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ project_directory=$(CURDIR)/../$(app_name)
build_tools_directory=$(CURDIR)/build/tools
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)
appstore_sign_dir=$(appstore_build_directory)/sign
cert_dir=$(build_tools_directory)/certificates
npm=$(shell which npm 2> /dev/null)
composer=$(shell which composer 2> /dev/null)

Expand Down Expand Up @@ -83,16 +85,36 @@ test: composer

# Builds the source package for the app store, ignores php and js tests
.PHONY: appstore
appstore:
rm -rf $(appstore_build_directory)
mkdir -p $(appstore_build_directory)
appstore: clean
mkdir -p $(appstore_sign_dir)/$(app_name)
composer install --no-dev
tar -cvzf $(appstore_package_name).tar.gz \
--exclude-vcs \
$(project_directory)/appinfo \
$(project_directory)/cfssl \
$(project_directory)/img \
$(project_directory)/js \
$(project_directory)/lib \
$(project_directory)/templates \
$(project_directory)/vendor
npm install --production
npm run build
cp -r \
appinfo \
cfssl \
img \
js \
l10n \
lib \
templates \
vendor \
CHANGELOG.md \
LICENSE \
$(appstore_sign_dir)/$(app_name)
chown -R www-data:www-data $(appstore_sign_dir)/$(app_name)

mkdir -p $(cert_dir)
@if [ -n "$$APP_PRIVATE_KEY" ]; then \
echo "$$APP_PRIVATE_KEY" > $(cert_dir)/$(app_name).key; \
echo "$$APP_PUBLIC_CRT" > $(cert_dir)/$(app_name).crt; \
echo "Signing app files…"; \
runuser -u www-data -- \
php ../../occ integrity:sign-app \
--privateKey=$(cert_dir)/$(app_name).key\
--certificate=$(cert_dir)/$(app_name).crt\
--path=$(appstore_sign_dir)/$(app_name); \
echo "Signing app files ... done"; \
fi
tar -czf $(appstore_package_name).tar.gz -C $(appstore_sign_dir) $(app_name)

Loading

0 comments on commit c606d53

Please sign in to comment.