Skip to content

Ingested document support #823

Ingested document support

Ingested document support #823

name: "Publish new release"
on:
pull_request:
branches:
- main
types:
- closed
jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true # only merged pull requests must trigger this job
steps:
- uses: actions/checkout@v2
- name: Installing fractl-io dependencies
run: |
git clone https://${{ secrets.REPO_READ_WRITE_TOKEN }}@github.com/fractl-io/fractl-config-secrets-reader
cd fractl-config-secrets-reader
lein install
- name: Install dependencies
run: lein deps
- name: Generate pom.xml needed for mvn deploy
run: lein pom
- name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from branch name (for hotfix branches)
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
# This feature is removed for now, as we do not depend upon Github Package Registry for jar files.
# Additionally, it causes some issue during mvn packaging.
# - name: Deploy to Github Package Registry
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# mkdir -p ~/.m2
# echo "<settings><servers><server><id>github</id><username>$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')</username><password>\${env.GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml
# mvn deploy
- name: Generate jar, uberjar and copy them to lib.
run: |
lein uberjar
mkdir /home/runner/work/fractl/fractl/lib
cp -r /home/runner/work/fractl/fractl/target/fractl-${{env.RELEASE_VERSION}}.jar /home/runner/work/fractl/fractl/lib/
cp -r /home/runner/work/fractl/fractl/target/fractl-${{env.RELEASE_VERSION}}-standalone.jar /home/runner/work/fractl/fractl/lib/
- name: Calculate SHA256 Checksum
id: sha
run: |
echo "Calculating SHA256 Checksum"
JAR_CHECKSUM=$(shasum -a 256 lib/*.jar | awk '{print $1}')
UBERJAR_CHECKSUM=$(shasum -a 256 lib/*-standalone.jar | awk '{print $1}')
echo "JAR_CHECKSUM=$JAR_CHECKSUM"
echo "UBERJAR_CHECKSUM=$UBERJAR_CHECKSUM"
- name: Create Release
uses: ncipollo/release-action@v1
with:
commit: ${{ github.event.pull_request.merge_commit_sha }}
tag: ${{ env.RELEASE_VERSION }}
artifacts: "/home/runner/work/fractl/fractl/lib/fractl-${{env.RELEASE_VERSION}}.jar,/home/runner/work/fractl/fractl/lib/fractl-${{env.RELEASE_VERSION}}-standalone.jar"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
- name: Cleanup jar
run: |
rm -r /home/runner/work/fractl/fractl/lib/fractl-${{env.RELEASE_VERSION}}.jar
rm -r /home/runner/work/fractl/fractl/lib/fractl-${{env.RELEASE_VERSION}}-standalone.jar
lein clean