Build and Draft Nightly Release #561
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
# This is a basic workflow to help you get started with Actions | |
name: Build and Draft Nightly Release | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
schedule: | |
- cron: "0 7 * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow checks to see if branch has any changes since last wo | |
prep: | |
runs-on: ubuntu-latest | |
name: Prepare for Build | |
outputs: | |
oldversion: ${{ steps.previoustag.outputs.tag }} | |
version: ${{ steps.semvers.outputs.patch }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 'check latest commit is less than a day' | |
id: check_commit | |
continue-on-error: true | |
if: ${{ github.event_name == 'schedule' }} | |
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT | |
- name: 'if not, do not build' | |
if: ${{ steps.check_commit.outputs.should_run == 'false' }} | |
run: exit 1 | |
- name: 'Check if nightly exists' | |
id: nightly | |
uses: cardinalby/git-get-release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
tag: 'nightly' | |
prerelease: true | |
doNotFailIfNotFound: true | |
- name: 'Get Previous tag' | |
id: previoustag | |
run: | | |
if [ "${{steps.nightly.outputs.id}}" == "" ]; then | |
echo "tag=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))" >> $GITHUB_OUTPUT | |
else | |
echo "tag=$(echo ${{steps.nightly.outputs.name}} | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/')" >> $GITHUB_OUTPUT | |
fi | |
- name: 'Get next version' | |
id: semvers | |
uses: "WyriHaximus/github-action-next-semvers@v1" | |
with: | |
version: ${{ steps.previoustag.outputs.tag }} | |
- name: output | |
run: echo ${{steps.previoustag.outputs.tag}} ${{steps.semvers.outputs.patch}} | |
build: | |
needs: prep | |
runs-on: windows-latest | |
name: Build RePlays | |
permissions: | |
contents: write | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.200 | |
- name: Download previous release to create delta | |
uses: robinraju/release-downloader@v1.3 | |
with: | |
token: ${{ secrets.MY_TOKEN }} | |
repository: ${{ github.repository }} | |
latest: true | |
fileName: "*" | |
# Relative path under $GITHUB_WORKSPACE to place the downloaded file(s) | |
# It will create the target directory automatically if not present | |
# eg: out-file-path: "my-downloads" => It will create directory $GITHUB_WORKSPACE/my-downloads | |
out-file-path: "bin/Deployment/Releases" | |
- name: Build LibObs | |
run: .\\build-libobs.cmd | |
shell: cmd | |
- name: Build RePlays | |
env: | |
CI: false | |
run: dotnet publish /p:Configuration=Release /p:Version=${{needs.prep.outputs.version}} /p:PublishProfile=FolderProfile | |
- name: Generate Prerelease | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: "nightly" | |
prerelease: true | |
allowUpdates: true | |
removeArtifacts: true | |
generateReleaseNotes: true | |
artifactErrorsFailBuild: true | |
name: ${{ format('Nightly RePlays v{0}', needs.prep.outputs.version )}} | |
artifacts: | | |
./bin/Deployment/Releases/RELEASES | |
./bin/Deployment/Releases/RePlaysSetup.exe | |
./bin/Deployment/Releases/RePlays-${{needs.prep.outputs.version}}-full.nupkg | |
./bin/Deployment/Releases/RePlays-${{needs.prep.outputs.version}}-delta.nupkg |