|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +# make it callable with required input of release-notes string |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'Version - patch version of the release (e.g. x.y.z)' |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + release-notes: |
| 12 | + description: 'Release Notes - string of markdown' |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + draft: |
| 16 | + description: 'Draft - true if the release should be a draft' |
| 17 | + required: true |
| 18 | + type: boolean |
| 19 | + default: true |
| 20 | + |
| 21 | +# in the first job |
| 22 | +# first, run on ubuntu-latest |
| 23 | +# then, install dependencies: moreutils, debhelper and help2man |
| 24 | +# then, using the input version create a v{input.version} tag at the head of the branch |
| 25 | +# then, checkout this repo |
| 26 | +# then, run the bash scripts: /scripts/package-deb and /scripts/package-tarball |
| 27 | +# in the next job |
| 28 | +# create a release using ncipollo/release-action@v1 to attach release notes and the artifacts and tag from the previous job |
| 29 | + |
| 30 | +jobs: |
| 31 | + build: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + sudo apt-get update |
| 37 | + sudo apt-get install -y moreutils debhelper help2man |
| 38 | + - name: Create tag |
| 39 | + run: | |
| 40 | + git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v2 |
| 43 | + - name: Package deb |
| 44 | + run: | |
| 45 | + bash scripts/package-deb |
| 46 | + - name: Package tarball |
| 47 | + run: | |
| 48 | + bash scripts/package-tarball |
| 49 | + release: |
| 50 | + needs: build |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - name: Create Release |
| 54 | + uses: ncipollo/release-action@v1 |
| 55 | + with: |
| 56 | + repo: github/backup-utils |
| 57 | + artifacts: | |
| 58 | + ./dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz |
| 59 | + ./dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb |
| 60 | + # token: ${{ secrets.GITHUB_TOKEN }} may need token, but try without first |
| 61 | + releaseName: v${{ github.event.inputs.version }} |
| 62 | + draft: ${{ github.event.inputs.draft }} |
| 63 | + body: ${{ github.event.inputs.release-notes }} |
0 commit comments