90 lines
3.4 KiB
YAML
90 lines
3.4 KiB
YAML
name: Build and Publish Astrolabe App Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'astrolabe-v*'
|
|
|
|
env:
|
|
APP_NAME: astrolabe
|
|
APP_DIR: third_party/astrolabe
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Get version from tag
|
|
id: tag
|
|
run: |
|
|
echo "TAG=${GITHUB_REF#refs/tags/astrolabe-v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Validate version in info.xml matches tag
|
|
working-directory: ${{ env.APP_DIR }}
|
|
run: |
|
|
INFO_VERSION=$(sed -n 's/.*<version>\(.*\)<\/version>.*/\1/p' appinfo/info.xml | tr -d '\t')
|
|
if [ "$INFO_VERSION" != "${{ steps.tag.outputs.TAG }}" ]; then
|
|
echo "Version mismatch: info.xml has $INFO_VERSION but tag is ${{ steps.tag.outputs.TAG }}"
|
|
exit 1
|
|
fi
|
|
echo "Version validated: $INFO_VERSION"
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
|
|
with:
|
|
php-version: 8.1
|
|
coverage: none
|
|
|
|
- name: Checkout Nextcloud server (for signing)
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
with:
|
|
repository: nextcloud/server
|
|
ref: stable30
|
|
path: server
|
|
|
|
- name: Install dependencies and build
|
|
working-directory: ${{ env.APP_DIR }}
|
|
run: |
|
|
composer install --no-dev --optimize-autoloader
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Setup signing certificate
|
|
run: |
|
|
mkdir -p $HOME/.nextcloud/certificates
|
|
echo "${{ secrets.APP_PRIVATE_KEY }}" > $HOME/.nextcloud/certificates/${{ env.APP_NAME }}.key
|
|
echo "${{ secrets.APP_PUBLIC_CRT }}" > $HOME/.nextcloud/certificates/${{ env.APP_NAME }}.crt
|
|
|
|
- name: Build app store package
|
|
working-directory: ${{ env.APP_DIR }}
|
|
run: make appstore server_dir=${{ github.workspace }}/server
|
|
|
|
- name: Create GitHub release and attach tarball
|
|
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: ${{ env.APP_DIR }}/build/artifacts/${{ env.APP_NAME }}.tar.gz
|
|
asset_name: ${{ env.APP_NAME }}-${{ steps.tag.outputs.TAG }}.tar.gz
|
|
tag: ${{ github.ref }}
|
|
release_name: Astrolabe ${{ steps.tag.outputs.TAG }}
|
|
prerelease: ${{ contains(steps.tag.outputs.TAG, '-alpha') || contains(steps.tag.outputs.TAG, '-beta') || contains(steps.tag.outputs.TAG, '-rc') }}
|
|
|
|
- name: Upload to Nextcloud App Store
|
|
uses: R0Wi/nextcloud-appstore-push-action@9244bb5445776688cfe90fa1903ea8dff95b0c28 # v1.0.4
|
|
with:
|
|
app_name: ${{ env.APP_NAME }}
|
|
appstore_token: ${{ secrets.APPSTORE_TOKEN }}
|
|
download_url: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.APP_NAME }}-${{ steps.tag.outputs.TAG }}.tar.gz
|
|
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
nightly: ${{ contains(steps.tag.outputs.TAG, '-alpha') || contains(steps.tag.outputs.TAG, '-beta') || contains(steps.tag.outputs.TAG, '-rc') }}
|