From 6d28f463dc9a91dee38567fe9fe34f9809c5536e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCarson?= Date: Mon, 12 Oct 2020 15:54:44 -0400 Subject: [PATCH] add automated release workflow --- .github/release-drafter.yml | 4 ++ .github/workflows/release.yml | 81 +++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..76001cc --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,4 @@ +template: | + ## What's Changed + + $CHANGES \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b224fa8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +name: Release new version +on: + workflow_dispatch: + inputs: + version: + description: 'The version number to use' + default: '0.0.0.0' + # Input has to be provided for the workflow to run + required: true +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Validate version number + run: | + # validate version structure + bash -c '[[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit 1' + # ensure version doesn't already exist + bash -c 'git rev-parse "v${{ github.event.inputs.version }}" >/dev/null 2>&1 && exit 2 || exit 0' + - name: Checkout + uses: actions/checkout@v2.3.3 + - name: Install dependencies + run: sudo apt install nuget mono-complete make + - name: Update version number, and commit + run: | + sed -ri "s/Version\(\"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\"\)/Version\(\"${{ github.event.inputs.version }}\"\)/g" AssemblyInfo.cs + git -c user.name="Github Actions" -c user.email="dyc3@users.noreply.github.com" commit -m "Update version" AssemblyInfo.cs + - name: Build + run: | + make + mv build steamguard-cli-v${{ github.event.inputs.version }} + tar -cf steamguard-cli-v${{ github.event.inputs.version }}.tar.gz steamguard-cli-v${{ github.event.inputs.version }} + - name: Tag and push version commit + run: | + git push origin master + git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" + - name: Upload Build Artifact + uses: actions/upload-artifact@v2.2.0 + with: + name: build + path: steamguard-cli-v${{ github.event.inputs.version }}.tar.gz + deb-package: + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Download Build Artifact (tar) + uses: actions/download-artifact@v2.0.5 + with: + name: build + - run: | + tar -xf steamguard-cli-v${{ github.event.inputs.version }}.tar.gz + mv steamguard-cli-v${{ github.event.inputs.version }} build + bash package.sh + - name: Upload deb + uses: actions/upload-artifact@v2.2.0 + with: + name: deb + path: steamguard-cli_${{ github.event.inputs.version }}-0.deb + # TODO: update AUR pkgbuild + draft: + needs: [build, deb-package] + runs-on: ubuntu-latest + steps: + - name: Download Build Artifact (tar) + uses: actions/download-artifact@v2.0.5 + with: + name: build + - name: Download Build Artifact (deb) + uses: actions/download-artifact@v2.0.5 + with: + name: deb + - name: Release Drafter + uses: release-drafter/release-drafter@v5.11.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: v${{ github.event.inputs.version }} + tag: v${{ github.event.inputs.version }} + version: ${{ github.event.inputs.version }} + publish: false