add automated release workflow

This commit is contained in:
“Carson 2020-10-12 15:54:44 -04:00
parent 6ffdb3ddc7
commit 6d28f463dc
2 changed files with 85 additions and 0 deletions

4
.github/release-drafter.yml vendored Normal file
View file

@ -0,0 +1,4 @@
template: |
## What's Changed
$CHANGES

81
.github/workflows/release.yml vendored Normal file
View file

@ -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