Skip to content

Build Dev

Build Dev #10

Workflow file for this run

name: Build Dev
on:
schedule:
- cron: '0 23 * * *'
workflow_dispatch:
env:
DOTNET_INSTALL_DIR: ./dotnet
DOTNET_VERSION: 8.0.x
RUN_TESTS: false
jobs:
build-android:
runs-on: ubuntu-latest
env:
PLATFORM: x64
CONFIG_NAME: Android_Debug
RELEASE_TAG_NAME: android_dev_debug
RELEASE_NAME: Android-Dev
# If true, the dotnet workload of WORKLOAD_NAME will be installed.
INSTALL_WORKLOAD: true
TARGET_WINDOWS: false
WORKLOAD_NAME: android
steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
- name: Get Current Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Cache dotnet
id: cache-dotnet
uses: actions/cache@v3
with:
path: ${{ env.DOTNET_INSTALL_DIR }}
key: ${{ runner.os }}-dotnet-${{ env.DOTNET_VERSION }}-${{ env.CONFIG_NAME }}
restore-keys: ${{ runner.os }}-dotnet-${{ env.DOTNET_VERSION }}-${{ env.CONFIG_NAME }}
- name: Install .NET [${{ env.DOTNET_VERSION }}]
if: ${{ steps.cache-dotnet.outputs.cache-hit != 'true' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install [${{ env.WORKLOAD_NAME }}] workload
if: ${{ env.INSTALL_WORKLOAD == 'true' }}
run: dotnet workload install ${{ env.WORKLOAD_NAME }}
- name: Run Tests
if: ${{ env.RUN_TESTS == 'true' }}
run: dotnet test --no-build --verbosity normal
- name: Build Debug
run: dotnet build /p:Platform="$PLATFORM" /p:EnableWindowsTargeting=$TARGET_WINDOWS --configuration $CONFIG_NAME
- name: Publish Artifacts
run: dotnet publish /p:EnableWindowsTargeting=$TARGET_WINDOWS --configuration $CONFIG_NAME --output ./publish_$CONFIG_NAME
- name: Zip build output
run: zip -r $RELEASE_TAG_NAME.zip ./publish_$CONFIG_NAME
- name: Create Release [${{ env.RELEASE_NAME }}]
id: build_create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{env.RELEASE_TAG_NAME}}-${{ steps.date.outputs.date }}
release_name: ${{ env.RELEASE_NAME }}-${{ steps.date.outputs.date }}
body: |
This is the ${{ env. CONFIG_NAME }} build.
draft: false
prerelease: true
- name: Upload Release Asset [${{ env.RELEASE_TAG_NAME }}.zip]
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.build_create_release.outputs.upload_url }}
asset_path: ./${{ env.RELEASE_TAG_NAME }}.zip
asset_name: ${{ env.RELEASE_TAG_NAME }}.zip
asset_content_type: application/zip
build-windows:
runs-on: ubuntu-latest
env:
PLATFORM: x64
CONFIG_NAME: Debug
RELEASE_TAG_NAME: windows_dev_debug
RELEASE_NAME: Windows-dev
# If true, the dotnet workload of WORKLOAD_NAME will be installed.
INSTALL_WORKLOAD: false
TARGET_WINDOWS: true
WORKLOAD_NAME: none
steps:
- name: Checkout Git Repo
uses: actions/checkout@v4
- name: Get Current Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Cache dotnet
id: cache-dotnet
uses: actions/cache@v3
with:
path: ${{ env.DOTNET_INSTALL_DIR }}
key: ${{ runner.os }}-dotnet-${{ env.DOTNET_VERSION }}-${{ env.CONFIG_NAME }}
restore-keys: ${{ runner.os }}-dotnet-${{ env.DOTNET_VERSION }}-${{ env.CONFIG_NAME }}
- name: Install .NET [${{ env.DOTNET_VERSION }}]
if: ${{ steps.cache-dotnet.outputs.cache-hit != 'true' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install [${{ env.WORKLOAD_NAME }}] workload
if: ${{ env.INSTALL_WORKLOAD == 'true' }}
run: dotnet workload install ${{ env.WORKLOAD_NAME }}
- name: Run Tests
if: ${{ env.RUN_TESTS == 'true' }}
run: dotnet test --no-build --verbosity normal
- name: Build Debug
run: dotnet build /p:Platform="$PLATFORM" /p:EnableWindowsTargeting=$TARGET_WINDOWS --configuration $CONFIG_NAME
- name: Publish Artifacts
run: dotnet publish /p:EnableWindowsTargeting=$TARGET_WINDOWS --configuration $CONFIG_NAME --output ./publish_$CONFIG_NAME
- name: Zip build output
run: zip -r $RELEASE_TAG_NAME.zip ./publish_$CONFIG_NAME
- name: Create Release [${{ env.RELEASE_NAME }}]
id: build_create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{env.RELEASE_TAG_NAME}}-${{ steps.date.outputs.date }}
release_name: ${{ env.RELEASE_NAME }}-${{ steps.date.outputs.date }}
body: |
This is the ${{ env. CONFIG_NAME }} build.
draft: false
prerelease: true
- name: Upload Release Asset [${{ env.RELEASE_TAG_NAME }}.zip]
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.build_create_release.outputs.upload_url }}
asset_path: ./${{ env.RELEASE_TAG_NAME }}.zip
asset_name: ${{ env.RELEASE_TAG_NAME }}.zip
asset_content_type: application/zip