Skip to content

Re-enable sbt CI release (#284) #92

Re-enable sbt CI release (#284)

Re-enable sbt CI release (#284) #92

Workflow file for this run

name: CI
on:
push:
tags: ['*']
pull_request:
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout Course Management Tools Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: 'sbt'
- name: Setup Coursier
run: |
curl -fLo coursier https://git.io/coursier-cli &&
chmod +x coursier &&
./coursier
- name: Publish Local
run: sbt publishLocal
- name: Package Binaries
run: |
mkdir -p course-management-tools-bin/bin
./coursier bootstrap com.lunatech:cmta_3:${{ env.RELEASE_VERSION }} -o course-management-tools-bin/bin/cmta --standalone --bat
./coursier bootstrap com.lunatech:cmtc_3:${{ env.RELEASE_VERSION }} -o course-management-tools-bin/bin/cmtc --standalone --bat
zip -r course-management-tools.zip course-management-tools-bin
- name: Upload artefacts
# id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: course-management-tools.zip
asset_name: course-management-tools.zip
asset_content_type: application/zip
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
release:
needs: create-release
runs-on: [ "${{ matrix.os }}" ]
strategy:
fail-fast: false
matrix:
os: [ 'macos-latest', 'ubuntu-latest', 'windows-latest' ]
include:
- os: macos-latest
uploaded_filename_cmta: cmta-x86_64-apple-darwin
local_path_cmta: cmta/target/native-image/cmta
uploaded_filename_cmtc: cmtc-x86_64-apple-darwin
local_path_cmtc: cmtc/target/native-image/cmtc
- os: ubuntu-latest
uploaded_filename_cmta: cmta-x86_64-pc-linux
local_path_cmta: cmta/target/native-image/cmta
uploaded_filename_cmtc: cmtc-x86_64-pc-linux
local_path_cmtc: cmtc/target/native-image/cmtc
- os: windows-latest
uploaded_filename_cmta: cmta-x86_64-pc-win32.exe
local_path_cmta: cmta\target\native-image\cmta.exe
uploaded_filename_cmtc: cmtc-x86_64-pc-win32.exe
local_path_cmtc: cmtc\target\native-image\cmtc.exe
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
env:
# define Java options for both official sbt and sbt-extras
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- name: Checkout Course Management Tools Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: 'sbt'
- name: Setup Coursier
run: |
curl -fLo coursier https://git.io/coursier-cli &&
chmod +x coursier &&
./coursier
- name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-latest' }}
- name: cmt native image generation
shell: bash
run: |
echo "------------------------------------------------------------"
echo $(pwd)
echo "------------------------------------------------------------"
sbt cmta/nativeImage
sbt cmtc/nativeImage
- name: Upload cmta artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.uploaded_filename_cmta }}
path: ${{ matrix.local_path_cmta }}
if-no-files-found: warn
retention-days: 1
- name: Upload cmtc artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.uploaded_filename_cmtc }}
path: ${{ matrix.local_path_cmtc }}
if-no-files-found: warn
retention-days: 1
release_bits:
needs: release
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Move and rename artifacts
shell: bash
run: |
# The following is repetitive and should be scripted
mv cmta-x86_64-pc-linux cmta-x86_64-pc-linux-tmp
mv cmta-x86_64-pc-linux-tmp/cmta cmta-x86_64-pc-linux
mv cmta-x86_64-apple-darwin cmta-x86_64-apple-darwin-tmp
mv cmta-x86_64-apple-darwin-tmp/cmta cmta-x86_64-apple-darwin
mv cmta-x86_64-pc-win32.exe cmta-x86_64-pc-win32-tmp.exe
mv cmta-x86_64-pc-win32-tmp.exe/cmta.exe cmta-x86_64-pc-win32.exe
mv cmtc-x86_64-pc-linux cmtc-x86_64-pc-linux-tmp
mv cmtc-x86_64-pc-linux-tmp/cmtc cmtc-x86_64-pc-linux
mv cmtc-x86_64-apple-darwin cmtc-x86_64-apple-darwin-tmp
mv cmtc-x86_64-apple-darwin-tmp/cmtc cmtc-x86_64-apple-darwin
mv cmtc-x86_64-pc-win32.exe cmtc-x86_64-pc-win32-tmp.exe
mv cmtc-x86_64-pc-win32-tmp.exe/cmtc.exe cmtc-x86_64-pc-win32.exe
- name: Upload-to-release
uses: softprops/action-gh-release@v1
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
generate_release_notes: true
fail_on_unmatched_files: false
files: |
cmta-x86_64-pc-linux
cmta-x86_64-apple-darwin
cmta-x86_64-pc-win32.exe
cmtc-x86_64-pc-linux
cmtc-x86_64-apple-darwin
cmtc-x86_64-pc-win32.exe