diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 000000000..df3aa5072 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,65 @@ +name: Build DuckGameRebuilt +description: Build DuckGameRebuilt + +runs: + using: "composite" + + steps: + - name: Install MSBuild + shell: bash + run: | + echo "::group::== Install MSBuild ==" + sudo apt-get update + sudo apt-get install -y msbuild zip + echo "::endgroup::" + + - name: Restore NuGet packages + shell: bash + run: | + echo "::group::== Restore NuGet packages ==" + nuget restore . + echo "::endgroup::" + + + - name: Add Project Dependencies [#1] + shell: bash + run: | + mkdir ./bin + cp ./DuckGame/lib/* ./bin + + - name: Build with AutoUpdater + shell: bash + run: | + echo "::group::== Build with AutoUpdater ==" + msbuild /m /p:Configuration=ReleaseAutoUpdater . + echo "::endgroup::" + + - name: Zip binaries + shell: bash + run: | + echo "::group::== Zip binaries ==" + mv ./bin ./DuckGameRebuilt + cd ./DuckGameRebuilt && zip -r ../DuckGameRebuilt.zip ./* && cd .. + echo "::endgroup::" + + - name: Add Project Dependencies [#2] + shell: bash + run: | + mkdir ./bin + cp ./DuckGame/lib/* ./bin + + - name: Build without AutoUpdater + shell: bash + run: | + echo "::group::== Build without AutoUpdater ==" + msbuild /m /p:Configuration=Release . + echo "::endgroup::" + + - name: Reorganize files for DGR mod + shell: bash + run: | + mv ./bin ./Rebuilder/dgr + find ./Rebuilder -maxdepth 1 ! \( -name "mod.conf" -o -name "Rebuilder.dll" \) -type f -exec rm {} + + rm -r ./Rebuilder/build + mkdir ./steammod + mv ./Rebuilder ./steammod/Rebuilder diff --git a/.github/workflows/autobuild_for_release.yml b/.github/workflows/autobuild_for_release.yml deleted file mode 100644 index 6af9e4eff..000000000 --- a/.github/workflows/autobuild_for_release.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Build, Zip, and Release - -on: - release: - branches: [ "master" ] - types: [published] - -jobs: - build_and_release: - runs-on: ubuntu-22.04 - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install MSBuild - run: | - sudo apt-get update - sudo apt-get install -y msbuild - - - name: Restore NuGet packages - run: nuget restore . - - - name: Add Project Dependencies [#1] - run: | - mkdir ./bin - cp ./DuckGame/lib/* ./bin - - - name: Build with AutoUpdater - run: msbuild /m /p:Configuration=ReleaseAutoUpdater . - - - name: Zip binaries - run: | - sudo apt-get update - sudo apt-get install -y zip - mv ./bin ./DuckGameRebuilt - cd ./DuckGameRebuilt && zip -r ../DuckGameRebuilt.zip ./* && cd .. - - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./DuckGameRebuilt.zip - overwrite: true - - - name: Add Project Dependencies [#2] - run: | - mkdir ./bin - cp ./DuckGame/lib/* ./bin - - - name: Build without AutoUpdater - run: msbuild /m /p:Configuration=Release . - - - name: Reorganize files for DGR mod - run: | - mv ./bin ./Rebuilder/dgr - find ./Rebuilder -maxdepth 1 ! \( -name "mod.conf" -o -name "Rebuilder.dll" \) -type f -exec rm {} + - rm -r ./Rebuilder/build - mkdir ./steammod - mv ./Rebuilder ./steammod/Rebuilder - - - name: Update DGR mod - uses: AnarkisGaming/workshop@v1 - with: - appID: 312530 - publishedFileID: ${{ vars.WORKSHOP_ID }} - path: ./steammod - changelog: ${{ github.event.release.body }} - env: - STEAM_ACCOUNT_NAME: "DuckGameRebuilt" - STEAM_PASSWORD: ${{ secrets.STEAM_PASS }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..ae00b569a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build + +on: + workflow_dispatch: + inputs: + upload-artifact: + description: Upload compiled artifact + type: boolean + default: false + + workflow_call: + inputs: + upload-artifact: + type: boolean + default: true + outputs: + artifact-name: + value: DuckGameRebuilt + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + submodules: recursive + fetch-depth: 1 + + - uses: ./.github/actions/build + + - name: Upload compiled artifact + if: ${{ inputs.upload-artifact }} + uses: actions/upload-artifact@v7 + with: + name: DuckGameRebuilt + path: DuckGameRebuilt.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..3f90b6acf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + release: + types: [published] + +jobs: + build_and_release: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + submodules: recursive + fetch-depth: 1 + + - uses: ./.github/actions/build + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: DuckGameRebuilt.zip + overwrite: true + + - name: Update DGR mod + uses: AnarkisGaming/workshop@v1 + with: + appID: 312530 + publishedFileID: ${{ vars.WORKSHOP_ID }} + path: ./steammod + changelog: ${{ github.event.release.body }} + env: + STEAM_ACCOUNT_NAME: "DuckGameRebuilt" + STEAM_PASSWORD: ${{ secrets.STEAM_PASS }}