Skip to content

Run Tests & Publish #52

Run Tests & Publish

Run Tests & Publish #52

name: Run Tests & Publish
on:
release:
types: [created]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
dotNetVersion: net6.0
dotNetConfiguration: Release
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Dotnet for use with actions
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.422'
- name: Cache Nuget Packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Run automated unit and integration tests
run: dotnet test
publish-osx:
needs: test
name: Publish for MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Dotnet for use with actions
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.100
6.0.416
- name: Cache Nuget Packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: macOS-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
macOS-nuget
- name: Set up npm
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install electronize
run: dotnet tool restore
- name: Install npm dependencies
working-directory: ./AuthoringTool
run: npm install
- name: Run Tailwind build
working-directory: ./AuthoringTool
run: npm run tailwind-build
- name: Build AuthoringTool binary
working-directory: ./AuthoringTool
run: dotnet electronize build /target osx
- name: Save Build folder
uses: actions/upload-artifact@v4
with:
name: authoringtool-osx
path: ./AuthoringTool/bin/Desktop_Publish/
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: AuthoringTool/bin/Desktop_Publish/AuthoringTool-${{ github.ref_name }}.dmg
asset_name: AuthoringTool-${{ github.ref_name }}.dmg
tag: ${{ github.ref }}
publish-windows:
needs: test
name: Publish for Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
# install dependencies, build, and test
- name: Setup Dotnet for use with actions
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.100'
- name: Cache Nuget Packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: Windows-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
Windows-nuget
- name: Set up npm
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install electronize
run: dotnet tool restore
- name: Install npm dependencies
working-directory: ./AuthoringTool
run: npm install
- name: Run Tailwind build
working-directory: ./AuthoringTool
run: npm run tailwind-build
- name: Build AuthoringTool binary
working-directory: ./AuthoringTool
run: dotnet electronize build /target win
- name: Save Build folder
uses: actions/upload-artifact@v4
with:
name: authoringtool-win
path: ./AuthoringTool/bin/Desktop_Publish/
- name: Pack windows-unpacked into zip
uses: vimtor/action-zip@v1
with:
files: ./AuthoringTool/bin/Desktop_Publish/win-unpacked
dest: ./AuthoringTool/bin/Desktop_Publish/${{ github.ref_name }}-win-unpacked.zip
- name: Upload Windows installer to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'AuthoringTool\\bin\\Desktop_Publish\\AuthoringTool Setup ${{ github.ref_name }}.exe'
asset_name: AuthoringTool-${{ github.ref_name }}-Windows-Setup.exe
tag: ${{ github.ref }}
- name: Upload win-unpacked zip to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: AuthoringTool/bin/Desktop_Publish/${{ github.ref_name }}-win-unpacked.zip
asset_name: AuthoringTool-${{ github.ref_name }}-win-unpacked.zip
tag: ${{ github.ref }}
publish-linux:
needs: test
name: Publish for Linux
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Dotnet for use with actions
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.100'
- name: Cache Nuget Packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: Linux-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
Linux-nuget
- name: Set up npm
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install electronize
run: dotnet tool restore
- name: Install npm dependencies
working-directory: ./AuthoringTool
run: npm install
- name: Run Tailwind build
working-directory: ./AuthoringTool
run: npm run tailwind-build
- name: Build AuthoringTool binary
working-directory: ./AuthoringTool
run: dotnet electronize build /target linux
- name: Save Build folder
uses: actions/upload-artifact@v4
with:
name: authoringtool-linux
path: ./AuthoringTool/bin/Desktop_Publish/
- name: Pack linux-unpacked into gzipped tarball
working-directory: ./AuthoringTool/bin/Desktop_Publish
run: tar -cavf ${{ github.ref_name }}-linux-unpacked.tar.gz ./linux-unpacked
- name: Upload linux snap to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: AuthoringTool/bin/Desktop_Publish/authoring-tool_${{ github.ref_name }}_amd64.snap
asset_name: AuthoringTool-${{ github.ref_name }}_amd64.snap
tag: ${{ github.ref }}
- name: Upload linux appimage to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: AuthoringTool/bin/Desktop_Publish/AuthoringTool-${{ github.ref_name }}.AppImage
asset_name: AuthoringTool-${{ github.ref_name }}.AppImage
tag: ${{ github.ref }}
- name: Upload linux-unpacked tar to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: AuthoringTool/bin/Desktop_Publish/${{ github.ref_name }}-linux-unpacked.tar.gz
asset_name: AuthoringTool-${{ github.ref_name }}-linux-unpacked.tar.gz
tag: ${{ github.ref }}
publish-linux-arm64:
needs: test
name: Publish for Linux ARM64
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2
- name: Setup Dotnet for use with actions
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.100'
- name: Cache Nuget Packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: Linux-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
Linux-nuget
- name: Set up npm
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install electronize
run: dotnet tool restore
- name: Install npm dependencies
working-directory: ./AuthoringTool
run: npm install
- name: Run Tailwind build
working-directory: ./AuthoringTool
run: npm run tailwind-build
- name: Build AuthoringTool binary
working-directory: ./AuthoringTool
run: dotnet electronize build /target custom "linux-arm64;linux" /electron-arch arm64
- name: Save Build folder
uses: actions/upload-artifact@v4
with:
name: authoringtool-linux-arm64
path: ./AuthoringTool/bin/Desktop_Publish/
- name: Pack linux-unpacked into gzipped tarball
working-directory: ./AuthoringTool/bin/Desktop_Publish
run: tar -cavf ${{ github.ref_name }}-linux-arm64-unpacked.tar.gz ./linux-arm64-unpacked
- name: Upload linux appimage to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: AuthoringTool/bin/Desktop_Publish/AuthoringTool-${{ github.ref_name }}-arm64.AppImage
asset_name: AuthoringTool-${{ github.ref_name }}-arm64.AppImage
tag: ${{ github.ref }}
- name: Upload linux-unpacked tar to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: AuthoringTool/bin/Desktop_Publish/${{ github.ref_name }}-linux-arm64-unpacked.tar.gz
asset_name: AuthoringTool-${{ github.ref_name }}-linux-arm64-unpacked.tar.gz
tag: ${{ github.ref }}
discord-notification:
needs: [test, publish-osx, publish-windows, publish-linux, publish-linux-arm64]
runs-on: ubuntu-22.04
steps:
- name: Prepare release body (description)
id: prep_body
run: |
echo "${{ github.event.release.body }}" > changes.md
- name: Discord notification
uses: appleboy/discord-action@master
with:
webhook_id: ${{ secrets.DISCORD_RELEASE_CHANNEL_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_RELEASE_CHANNEL_WEBHOOK_TOKEN }}
username: GitHub Releases
message: "New release of **${{ github.repository }}**\nVersion: ${{ github.ref_name }} (${{github.event.release.name}})\n<${{ github.event.release.html_url }}>"
file: changes.md