Publish Nightly Server Release #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Nightly Server Release | |
on: | |
schedule: | |
- cron: '0 0 * * *' # run at midnight UTC | |
workflow_dispatch: | |
env: | |
DOTNET_VERSION: '9.0.x' | |
jobs: | |
check_date: | |
runs-on: ubuntu-latest | |
name: Check latest commit | |
outputs: | |
should_run: ${{ steps.should_run.outputs.should_run }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Print Commit Hash | |
run: echo ${{ github.sha }} | |
- id: should_run | |
continue-on-error: true | |
name: Check if the latest commit was within the last 24 hours | |
if: ${{ github.event_name == 'schedule' }} | |
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false" | |
server: | |
name: Publish Nightly Server Builds | |
runs-on: ubuntu-latest | |
needs: check_date | |
if: ${{ needs.check_date.outputs.should_run != 'false' && github.ref == 'refs/heads/develop' }} | |
permissions: | |
contents: write | |
env: | |
DatabaseConfiguration__UseInMemoryDb: true | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Build API Packages | |
run: | | |
cd Services/Bones.Api | |
dotnet tool restore | |
dotnet deb --configuration Release --version-suffix nightly --output ../../publish/ | |
dotnet rpm --configuration Release --version-suffix nightly --output ../../publish/ | |
cd ../.. | |
- name: Build Background Service Packages | |
run: | | |
cd Services/Bones.BackgroundService | |
dotnet tool restore | |
dotnet deb --configuration Release --version-suffix nightly --output ../../publish/ | |
dotnet rpm --configuration Release --version-suffix nightly --output ../../publish/ | |
cd ../.. | |
- name: Delete previous release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release delete nightly --cleanup-tag --yes | |
sleep 10 | |
- name: Upload Nightly Server Packages | |
uses: ncipollo/release-action@v1 | |
with: | |
body: Nightly release of server artifacts | |
name: Nightly Server Release | |
tag: 'nightly' | |
makeLatest: true | |
prerelease: true | |
artifacts: './publish/Bones.Api.*.linux-x64.deb,./publish/Bones.Api.*.linux-x64.rpm,./publish/Bones.BackgroundService.*.linux-x64.deb,./publish/Bones.BackgroundService.*.linux-x64.rpm' |