From 06b685df218696174228b7b4623c7997312414ac Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Sat, 14 Mar 2020 10:34:13 -0700 Subject: [PATCH] GitHub CI Updates Adds automation of build and release assets upon release. --- .github/workflows/build.yml | 26 ------------------ .github/workflows/commit.yml | 31 +++++++++++++++++++++ .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/commit.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 2eadb3ce..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: CI - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: rlespinasse/github-slug-action@1.1.0 - - - name: Install Dependencies - run: | - sudo apt-get install libncurses-dev - - name: Build - run: | - make - make clean - rm -rf .git - - name: Upload Archive - uses: actions/upload-artifact@v1 - with: - name: RomWBW-${{env.GITHUB_REF_SLUG}}-${{env.GITHUB_SHA_SHORT}} - path: . diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml new file mode 100644 index 00000000..7cdbe1a0 --- /dev/null +++ b/.github/workflows/commit.yml @@ -0,0 +1,31 @@ +name: Commit Build + +on: + push: + branches: + - master + tags-ignore: + - v* + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: rlespinasse/github-slug-action@1.1.0 + + - uses: actions/checkout@v2 + + - name: Build + run: | + sudo apt-get install libncurses-dev + make + make clean + rm -rf .git* + + - name: Upload Artifact + uses: actions/upload-artifact@v1 + with: + name: RomWBW-${{env.GITHUB_REF_SLUG}}-${{env.GITHUB_SHA_SHORT}} + path: . \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5e5fbaaf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release Build + +on: + release: + types: published + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Create Package Label + run: | + LABEL=`echo "$GITHUB_REF" | sed "s|^refs/tags/||"` + echo "::set-env name=PKGLBL::$LABEL" + + - name: Display Diagnostics + run: | + echo PKGLBL: "$PKGLBL" + echo Upload URL: "${{github.event.release.upload_url}}" + echo GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" + + - name: Build + run: | + sudo apt-get install libncurses-dev + make + make clean + rm -rf .git* + + - name: Upload Artifact + uses: actions/upload-artifact@v1 + with: + name: RomWBW-${{env.PKGLBL}}-Package + path: . + + - name: Create Package Archive + run: | + zip -r Package.zip . + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{github.event.release.upload_url}} + asset_path: Package.zip + asset_name: RomWBW-${{env.PKGLBL}}-Package.zip + asset_content_type: application/zip \ No newline at end of file