Skip to content

Create and publish a eXo Community binary #33

Create and publish a eXo Community binary

Create and publish a eXo Community binary #33

Workflow file for this run

name: Create and publish a eXo Community binary
on:
push:
tags:
- '[6-9].[0-9].[0-9]'
env:
DOWNLOAD_URL: 'https://repository.exoplatform.org/content/groups/public/org/exoplatform/platform/distributions/plf-community-tomcat-standalone'
DOWNLOAD_BINARY_PREFFIX: 'plf-community-tomcat-standalone'
DOWNLOAD_BINARY_ZIP_FOLDER_PREFIX: 'platform-community'
SF_HOST: 'frs.sourceforge.net'
SF_PROJECT: 'exo'
jobs:
publish:
name: build_release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Release version
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Download eXo Community binary from Nexus
run: |
wget ${DOWNLOAD_URL}/${RELEASE_VERSION}/${DOWNLOAD_BINARY_PREFFIX}-${RELEASE_VERSION}.zip
sha256sum ${DOWNLOAD_BINARY_PREFFIX}-${RELEASE_VERSION}.zip > SHA256SUMS
unzip -j ${DOWNLOAD_BINARY_PREFFIX}-${RELEASE_VERSION}.zip ${DOWNLOAD_BINARY_ZIP_FOLDER_PREFIX}-${RELEASE_VERSION}/CHANGE_LOG.txt
echo "## What's Changed" >> WHATSCHANGED.TXT
cat CHANGE_LOG.txt | grep -P ^- | grep -qi feature && echo "Features:" >> WHATSCHANGED.TXT
cat CHANGE_LOG.txt | grep -P ^- | grep -i feature | sed -E 's/^-/*/g' >> WHATSCHANGED.TXT
cat CHANGE_LOG.txt | grep -P ^- | grep -qi feature && echo "" >> WHATSCHANGED.TXT
cat CHANGE_LOG.txt | grep -P ^- | grep -qi fix && echo "Bug fixes:" >> WHATSCHANGED.TXT
cat CHANGE_LOG.txt | grep -P ^- | grep -i fix | sed -E 's/^-/*/g' >> WHATSCHANGED.TXT
echo "<h2>What's Changed</h2>" > README.md
cat CHANGE_LOG.txt | grep -P ^- | grep -qi feature && echo "<h3>Features:</h3>" >> README.md && echo "<ul>" >> README.md
cat CHANGE_LOG.txt | grep -P ^- | grep -i feature | sed -E -e 's/[<>]//g' -e 's|^-|<li>|g' -e 's|$|</li>|g' >> README.md
cat CHANGE_LOG.txt | grep -P ^- | grep -qi feature && echo "</ul>" >> README.md
cat CHANGE_LOG.txt | grep -P ^- | grep -qi fix && echo "<h3>Bug fixes:</h3>" >> README.md && echo "<ul>" >> README.md
cat CHANGE_LOG.txt | grep -P ^- | grep -i fix | sed -E -e 's/[<>]//g' -e 's|^-|<li>|g' -e 's|$|</li>|g' >> README.md
cat CHANGE_LOG.txt | grep -P ^- | grep -qi fix && echo "</ul>" >> README.md
rm -v CHANGE_LOG.txt
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ env.RELEASE_VERSION }}
tag_name: ${{ github.ref }}
body_path: WHATSCHANGED.TXT
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload eXo Community binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.DOWNLOAD_BINARY_PREFFIX }}-${{ env.RELEASE_VERSION }}.zip
asset_name: ${{ env.DOWNLOAD_BINARY_PREFFIX }}-${{ env.RELEASE_VERSION }}.zip
asset_content_type: application/zip
- name: upload eXo Community SHA256SUMS
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: SHA256SUMS
asset_name: SHA256SUMS
asset_content_type: text/plain
- name: Upload to SF
run: |
mv ${{ env.DOWNLOAD_BINARY_PREFFIX }}-${{ env.RELEASE_VERSION }}.zip eXo-Platform-${{ env.RELEASE_VERSION }}.zip
echo "${{ secrets.SF_SSH_KEY }}" > /tmp/sshkey
chmod 0600 /tmp/sshkey
rsync -avP -e 'ssh -i /tmp/sshkey -o StrictHostKeyChecking=no' eXo-Platform-${{ env.RELEASE_VERSION }}.zip README.md ${{ secrets.SF_USERNAME }}@${{ env.SF_HOST }}:/home/frs/p/${{ env.SF_PROJECT }}/${{ env.RELEASE_VERSION }}