Skip to content

Merge pull request #452 from ConductionNL/feature/connector-185/write… #26

Merge pull request #452 from ConductionNL/feature/connector-185/write…

Merge pull request #452 from ConductionNL/feature/connector-185/write… #26

Workflow file for this run

name: Beta Release
on:
push:
branches:
- beta
jobs:
release-management:
runs-on: ubuntu-latest
steps:
# Stap 1: Code ophalen
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}
# Stap 2: Stel de appnaam in (gebruik de repo-naam)
- name: Set app env
run: |
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
# Stap 3: Haal huidige versie uit info.xml, verhoog de patch en voeg beta-suffix toe
- name: Get current version and append beta suffix
id: increment_version
run: |
# Get version from main branch
git fetch origin main
main_version=$(git show origin/main:appinfo/info.xml | grep -oP '(?<=<version>)[^<]+' || echo "")
# Get current version from development branch
current_version=$(grep -oP '(?<=<version>)[^<]+' appinfo/info.xml || echo "")
# Split main version into parts
IFS='.' read -ra main_version_parts <<< "$main_version"
# Increment patch version by 1 from main
next_patch=$((main_version_parts[2] + 1))
# Extract beta counter from current version if it exists
beta_counter=1
if [[ $current_version =~ -beta\.([0-9]+)$ ]]; then
# If current patch version is still ahead of main, increment counter
current_patch=$(echo $current_version | grep -oP '^[0-9]+\.[0-9]+\.(\d+)' | cut -d. -f3)
if [ "$current_patch" -eq "$next_patch" ]; then
beta_counter=$((BASH_REMATCH[1] + 1))
fi
fi
beta_version="${main_version_parts[0]}.${main_version_parts[1]}.${next_patch}-beta.${beta_counter}"
echo "NEW_VERSION=$beta_version" >> $GITHUB_ENV
echo "new_version=$beta_version" >> $GITHUB_OUTPUT
echo "Main version: $main_version"
echo "Current version: $current_version"
echo "Using beta version: $beta_version"
# Stap 4: Update de versie in info.xml
- name: Update version in info.xml
run: |
sed -i "s|<version>.*</version>|<version>${{ env.NEW_VERSION }}</version>|" appinfo/info.xml
# Stap 5: Commit de nieuwe versie (indien er wijzigingen zijn)
- name: Commit version update
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Bump beta version to ${{ env.NEW_VERSION }} [skip ci]"
git push
# Stap 6: Bereid de signing certificaten voor
- name: Prepare Signing Certificate and Key
run: |
echo "${{ secrets.NEXTCLOUD_SIGNING_CERT }}" > signing-cert.crt
echo "${{ secrets.NEXTCLOUD_SIGNING_KEY }}" > signing-key.key
# Stap 7: Installeer npm dependencies
- name: Install npm dependencies
uses: actions/setup-node@v3
with:
node-version: '18.x'
# Stap 8: Stel PHP in en installeer benodigde extensies
- name: Set up PHP and install extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: zip, gd
# Stap 9: Voer npm install, build en composer install uit
- run: npm ci
- run: npm run build
- run: composer install --no-dev
# Stap 10: Kopieer de bestanden naar de package directory
- name: Copy the package files into the package
run: |
mkdir -p package/${{ github.event.repository.name }}
rsync -av --progress \
--exclude='package' \
--exclude='.git' \
--exclude='.github' \
--exclude='.vscode' \
--exclude='docker' \
--exclude='docs' \
--exclude='website' \
--exclude='node_modules' \
--exclude='/src' \
--exclude='test' \
--exclude='package-lock.json' \
--exclude='composer.lock' \
--exclude='composer-setup.php' \
--exclude='.phpunit.result.cache' \
--exclude='phpmd.xml' \
--exclude='signing-key.key' \
--exclude='package.json' \
--exclude='composer.json' \
--exclude='coverage.txt' \
--exclude='signing-cert.crt' \
--exclude='docker-compose.yml' \
--exclude='webpack.config.js' \
--exclude='.prettierrc' \
--exclude='psalm.xml' \
--exclude='phpunit.xml' \
--exclude='tsconfig.json' \
--exclude='changelog-ci-config.json' \
--exclude='jest.config.js' \
--exclude='.gitattributes' \
--exclude='.php-cs-fixer.dist.php' \
--exclude='.gitignore' \
--exclude='.eslintrc.js' \
--exclude='stylelint.config.js' \
--exclude='.babelrc' \
--exclude='.nvmrc' \
./ package/${{ github.event.repository.name }}/
# Stap 11: Maak het TAR.GZ archief
- name: Create Tarball
run: |
cd package && tar -czf ../nextcloud-release.tar.gz ${{ github.event.repository.name }}
# Stap 12: Sign het TAR.GZ bestand met OpenSSL
- name: Sign the TAR.GZ file with OpenSSL
run: |
openssl dgst -sha512 -sign signing-key.key nextcloud-release.tar.gz | openssl base64 -out nextcloud-release.signature
# Stap 13: Genereer Git versie informatie (optioneel, voor logging)
- name: Git Version
id: version
uses: codacy/[email protected]
with:
release-branch: beta
# Stap 14: Extraheer repository description (optioneel)
- name: Extract repository description
id: repo-description
run: |
description=$(jq -r '.description' <(curl -s https://api.github.com/repos/${{ github.repository }}))
echo "REPO_DESCRIPTION=$description" >> $GITHUB_ENV
# Stap 15: Output de versie (voor logging)
- name: Use the version
run: |
echo "Git Version info: ${{ steps.version.outputs.version }}"
rsync -av --progress --exclude='package' --exclude='.git' ./ package/${{ github.event.repository.name }}/
# Stap 17: Maak een nieuwe GitHub release (als prerelease)
- name: Upload Beta Release
uses: ncipollo/[email protected]
with:
tag: v${{ env.NEW_VERSION }}
name: Beta Release ${{ env.NEW_VERSION }}
draft: false
prerelease: true
# Stap 18: Voeg het tarball toe als asset aan de GitHub release
- name: Attach tarball to GitHub release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: nextcloud-release.tar.gz
asset_name: ${{ env.APP_NAME }}-${{ env.NEW_VERSION }}.tar.gz
tag: v${{ env.NEW_VERSION }}
overwrite: true
# Stap 19: Upload de app naar de Nextcloud App Store
- name: Upload app to Nextcloud appstore
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1
with:
app_name: ${{ env.APP_NAME }}
appstore_token: ${{ secrets.NEXTCLOUD_APPSTORE_TOKEN }}
download_url: https://github.com/${{ github.repository }}/releases/download/v${{ env.NEW_VERSION }}/${{ env.APP_NAME }}-${{ env.NEW_VERSION }}.tar.gz
app_private_key: ${{ secrets.NEXTCLOUD_SIGNING_KEY }}
nightly: false
# Stap 20: Verifieer de release
- name: Verify version and contents
run: |
echo "App version: ${{ env.NEW_VERSION }}"
echo "Tarball contents:"
tar -tvf nextcloud-release.tar.gz
echo "info.xml contents:"
tar -xOf nextcloud-release.tar.gz ${{ env.APP_NAME }}/appinfo/info.xml