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 with: submodules: true - 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