Skip to content

Commit

Permalink
Add a release workflow
Browse files Browse the repository at this point in the history
Should be auto-filling the release information and upload
a source distro package tarball.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
mchehab committed Jan 21, 2023
1 parent d77847f commit 46f6e49
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/gen_release.pl
Original file line number Diff line number Diff line change
@@ -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 (<IN>) {
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 (<IN>) {
last if (m/$ver/);
}
while (<IN>) {
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 "");
44 changes: 44 additions & 0 deletions .github/workflows/on_tag.yml
Original file line number Diff line number Diff line change
@@ -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/

0 comments on commit 46f6e49

Please sign in to comment.