Add build types to build script; enable CI for all branches

This commit is contained in:
ghorsington committed 2022-08-14 17:19:09 +03:00
1 parent 27016a3680
commit add17f1fe8
3 files changed
+51 -22

No files matched your search

@@ -1,15 +1,12 @@
name: Build Bleeding Edge
name: Build
on:
push:
branches:
- master
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Need to fetch all for proper history
- name: Collect build info
@@ -17,12 +14,22 @@ jobs:
uses: actions/github-script@v6
with:
script: |
core.setOutput("is_be", context.repo.owner == "BepInEx");
core.setOutput("sha_short", await exec.exec("git", ["rev-parse", "--short", "HEAD"]));
core.setOutput("build_id", context.run.runNumber + 500); // builds.bepinex.dev build numbers start at 500
let buildType = "Development";
if (context.ref == "refs/heads/master" && context.repo.owner == "BepInEx") {
buildType = "BleedingEdge";
}
core.setOutput("build_type", buildType);
let shortHash = "";
await exec.exec("git", ["rev-parse", "--short", "HEAD"], {
listeners: {
stdout: d => shortHash += d.toString().trim(),
}
});
core.setOutput("sha_short", shortHash);
core.setOutput("build_id", context.runNumber + 600); // builds.bepinex.dev build numbers start at 500
- uses: nrwl/last-successful-commit-action@v1
id: last_successful_commit
if: ${{ steps.info.outputs.is_be == 'true' && env.GITHUB_TOKEN != null }}
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' && env.GITHUB_TOKEN != null }}
with:
branch: master
workflow_id: build_be.yml
@@ -32,15 +39,17 @@ jobs:
dotnet-version: "6.0.x"
- name: Build
run: |
./build.sh --target Publish --bleeding-edge ${{ steps.info.outputs.is_be }} --build-id ${{ steps.info.outputs.build_id }} --last-build-commit \"${{ steps.last_successful_commit.outputs.commit_hash }}\" --nuget-api-key \"${{ secrets.BEPIN_DEV_NUGET_KEY }}\"
./build.sh --target Publish --build-type ${{ steps.info.outputs.build_type }} --build-id ${{ steps.info.outputs.build_id }} --last-build-commit \"${{ steps.last_successful_commit.outputs.commit_hash }}\" --nuget-api-key \"${{ secrets.BEPIN_DEV_NUGET_KEY }}\"
- name: Upload to BepinBuilds
if: ${{ steps.info.outputs.is_be == 'true' && secrets.BEPISBUILDS_HOST != null }}
env:
BEPISBUILDS_HOST: ${{ secrets.BEPISBUILDS_HOST }}
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' && env.BEPISBUILDS_HOST != null }}
run: |
artifacts_list=$(ls ./bin/dist/*.* | tr '\n' ','); artifacts_list=${artifacts_list::-1};
curl --upload-file "{${artifacts_list}}" --ftp-pasv --ftp-skip-pasv-ip --ftp-create-dirs --ftp-method singlecwd --disable-epsv "ftp://${{ secrets.BEPISBUILDS_AUTH }}@${{ secrets.BEPISBUILDS_HOST }}:${{ secrets.BEPISBUILDS_PORT }}/bepinex_be/artifacts/${{ steps.info.outputs.build_id }}/"
- name: Generate changelog
id: generate_changelog
if: ${{ steps.info.outputs.is_be == 'true' }}
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' }}
run: |
changelog=$(git --no-pager log --no-merges --pretty="format:- (\`%h\`) [%an] %s" ${{ steps.last_successful_commit.outputs.commit_hash }}..HEAD | sed ':a;N;$!ba;s/"/\"/g' | sed ':a;N;$!ba;s/\n/\\n/g')
echo "::set-output name=changelog::$changelog"
@@ -48,7 +57,7 @@ jobs:
uses: joelwmale/webhook-action@2.1.0
env:
BEPINEX_DISCORD_WEBHOOK: ${{ secrets.BEPINEX_DISCORD_WEBHOOK }}
if: ${{ steps.info.outputs.is_be == 'true' && env.BEPINEX_DISCORD_WEBHOOK != null }}
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' && env.BEPINEX_DISCORD_WEBHOOK != null }}
with:
url: ${{ secrets.BEPINEX_DISCORD_WEBHOOK }}
body: |
@@ -66,5 +75,5 @@ jobs:
uses: actions/upload-artifact@v2.2.4
with:
path: "./bin/dist/*.zip"
name: "BepInEx_CI_${{ steps.info.outputs.sha_short }}_${{ steps.info.outputs.build_id || 0 }}"
name: "BepInEx_CI_${{ steps.info.outputs.build_type }}_${{ steps.info.outputs.sha_short }}_${{ steps.info.outputs.build_id || 0 }}"