From: Mauro Carvalho Chehab Date: Sat, 21 Jan 2023 13:49:40 +0000 (+0100) Subject: Add a release workflow X-Git-Tag: v0.7.0~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=46f6e49a562c7577fbc0ad98fbe965ea5e7040f1;p=users%2Fmchehab%2Frasdaemon.git Add a release workflow Should be auto-filling the release information and upload a source distro package tarball. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/.github/workflows/gen_release.pl b/.github/workflows/gen_release.pl new file mode 100755 index 0000000..75a698e --- /dev/null +++ b/.github/workflows/gen_release.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +my $body_path = shift or die "Need a file name to store the release body"; + +my $ver; + +open IN, "configure.ac" or die; +while () { + if (m/^[^\#]*AC_INIT\s*\(\s*\[\s*RASdaemon\s*\]\s*,\s*\[?(\d+[\.\d]+)/) { + $ver=$1; + last; + } +} +close IN or die "can't open configure.ac"; + +die "Can't get version from configure.ac" if (!$ver); + +sub gen_version() { + print "$ver\n"; + + open IN, "ChangeLog" or return "error opening ChangeLog"; + open OUT, ">$body_path" or return "error creating $body_path"; + while () { + last if (m/$ver/); + } + while () { + next if (m/^$/); + last if (m/^\S/); + + my $ln = $_; + $ln =~ s/^\s+\*/-/; + print OUT $ln; + } + close OUT or return "error closing $body_path"; + + return ""; +} + +my $ret = gen_version(); + +die($ret) if ($ret ne ""); diff --git a/.github/workflows/on_tag.yml b/.github/workflows/on_tag.yml new file mode 100644 index 0000000..6cc33eb --- /dev/null +++ b/.github/workflows/on_tag.yml @@ -0,0 +1,44 @@ +name: Create release on tag + +on: + workflow_dispatch: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v[0-9]+*' + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - uses: actions/checkout@v2 + - name: Release changelog + run: | + .github/workflows/gen_release.pl body_file.tmp > version + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body_path: body_file.tmp + draft: false + prerelease: true + - name: Create Source Package + run: | + autoreconf -vfi + ./configure --enable-all + make dist-bzip2 + mkdir artifacts + mv rasdaemon-$(cat version).tar.bz2 artifacts + - name: Archive package + uses: actions/upload-artifact@v1 + with: + name: rasdaemon-source-package + path: artifacts/ +