Build snapshots with releases #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HiDrive Next Build | |
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors | |
# SPDX-FileCopyrightText: 2024 STRATO AG | |
# SPDX-License-Identifier: AGPL-3.0-or-later | |
# The HiDrive Next source is packaged as a container image. | |
# This is a workaround because releases can not be created without tags | |
# and we want to be able to create snapshots from branches. | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/**' | |
- 'src/**' | |
- 'custom-npms/**' | |
- 'apps/**' | |
- 'apps/**/appinfo/info.xml' | |
- 'apps-custom/**' | |
- 'package.json' | |
- 'package-lock.json' | |
- 'themes/**' | |
- 'tsconfig.json' | |
- '**.js' | |
- '**.ts' | |
- '**.vue' | |
push: | |
branches: | |
# Enable once approved | |
# - ionos-dev | |
- tl/dev/workflow-build-snapshots-with-releases | |
env: | |
PACKAGE_NAME_PREFIX: hidrive-next | |
PACKAGE_NAME_EXTENSION: zip | |
permissions: | |
contents: read | |
jobs: | |
hidrive-next-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
name: hidrive-next-build | |
steps: | |
- name: Checkout server | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 | |
with: | |
submodules: true | |
- name: Set up node with version from package.json's engines | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version-file: "package.json" | |
- name: Build Nextcloud | |
run: make -f IONOS/Makefile build_nextcloud FONTAWESOME_PACKAGE_TOKEN=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }} | |
- name: Install dependencies & build simplesettings app | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
PUPPETEER_SKIP_DOWNLOAD: true | |
run: make -f IONOS/Makefile build_dep_simplesettings_app | |
- name: Install dependencies & build viewer app | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
PUPPETEER_SKIP_DOWNLOAD: true | |
run: make -f IONOS/Makefile build_dep_viewer_app | |
- name: Install dependencies & build user_oidc app | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
PUPPETEER_SKIP_DOWNLOAD: true | |
run: make -f IONOS/Makefile build_dep_user_oidc_app | |
- name: Install dependencies for external apps nc_ionos_processes | |
run: make -f IONOS/Makefile build_dep_nc_ionos_processes_app | |
- name: Build Custom CSS | |
run: make -f IONOS/Makefile build_dep_theming_app | |
- name: Install dependencies & build IONOS theme custom elements | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
PUPPETEER_SKIP_DOWNLOAD: true | |
run: make -f IONOS/Makefile build_dep_ionos_theme | |
- name: Add config partials | |
run: make -f IONOS/Makefile add_config_partials | |
- name: Build package name | |
run: | | |
TAG_NAME="rel-$( date '+%Y%m%d-%H%M%S' )" | |
SAFE_REF_NAME=${GITHUB_REF_NAME/\//-} | |
echo "TAG_NAME=${TAG_NAME}" >> ${GITHUB_ENV} | |
echo "PACKAGE_NAME=${PACKAGE_NAME_PREFIX}-${TAG_NAME}.${PACKAGE_NAME_EXTENSION}" >> ${GITHUB_ENV} | |
- name: Zip dependencies | |
run: make -f IONOS/Makefile zip_dependencies TARGET_PACKAGE_NAME=${{ env.PACKAGE_NAME }} | |
- name: Checksum | |
run: sha256sum ${{ env.PACKAGE_NAME }} >> ${{ env.PACKAGE_NAME }}.sha256 | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
# Draft | |
# | |
# * allows release creation withouth a tag | |
# * does not list releases (they're accessible via hidden URL) | |
# | |
# Downside: the release is not queriable via API without token or | |
# with fine-grained access tokens with content:read | |
# permission. Only classic personal tokens with | |
# "public_repo" allow querying via: | |
# curl --silent -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${TOKEN}" https://api.github.com/repos/<OWNER>/<REPO>/releases | jq '.[] | select(.draft == true)' | |
# | |
# Create classic token with "public_repo" scope here: https://github.com/settings/tokens/new | |
# | |
draft: false | |
prerelease: true | |
tag_name: ${{ env.TAG_NAME }} | |
files: | | |
${{ env.PACKAGE_NAME }} | |
${{ env.PACKAGE_NAME }}.sha256 | |
- name: Show changes on failure | |
if: failure() | |
run: | | |
exit 1 # make it red to grab attention |