Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Build test
on:
push:
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Draft Release

on:
pull_request:
types: [opened, synchronize, reopened, closed]
paths:
- VERSION
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
validate-release-commit:
if: >
!(github.event.pull_request.merged == true &&
!contains(join(github.event.pull_request.labels.*.name), 'release'))

runs-on: ubuntu-latest

steps:
- name: Checkout merge
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get release commit info
id: version
run: |
ver=$(cat VERSION)
if ! echo "$ver" | grep -Eq '^[0-9]{4}\.[0-9]{2}\.[0-9]+$'; then
echo "Invalid version format: $ver"
exit 1
fi

echo "version=$ver" >> $GITHUB_OUTPUT

headline="$(git show --format=%s ${{github.event.pull_request.head.sha}})"
if ! echo "$headline" | grep -Eq "^[Rr]elease microcom $ver$"; then
echo "Invalid commit headline: $headline"
exit 1
fi

body="$(
git show -s --format=%b ${{github.event.pull_request.head.sha}} \
| sed -E '/^Signed-off-by: /d'
)"

echo 'body<<EOF' >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

- name: Install Dependencies
run: sudo apt install -y libreadline6-dev autoconf automake

- name: Build release packages
run: |
autoreconf -i
./configure
make check
make dist

# DRAFT release on pr creation and update
- name: Create or update release draft
if: github.event.pull_request.merged == false
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: v${{steps.version.outputs.version}}
name: microcom ${{steps.version.outputs.version}}
body: ${{steps.version.outputs.body}}
files: |
microcom-*.tar.gz
microcom-*.tar.xz

# PUBLISH release on merge
- name: Publish release on merge
if: github.event.pull_request.merged == true
uses: softprops/action-gh-release@v2
with:
draft: false
tag_name: v${{steps.version.outputs.version}}
files: |
microcom-*.tar.gz
microcom-*.tar.xz

- run: gh pr edit "$NUMBER" --add-label "$LABELS"
if: github.event.pull_request.merged == false
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
GH_REPO: ${{github.repository}}
NUMBER: ${{github.event.pull_request.number}}
LABELS: release

- run: gh pr comment "$NUMBER" --body "Release published!"
if: github.event.pull_request.merged == true
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
GH_REPO: ${{github.repository}}
NUMBER: ${{github.event.pull_request.number}}
LABELS: release
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4 --install

EXTRA_DIST = DCO README.md
EXTRA_DIST = COPYING DCO README.md VERSION

bin_PROGRAMS = microcom
microcom_SOURCES = commands.c commands_fsl_imx.c microcom.c mux.c parser.c serial.c telnet.c
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023.09.0
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([microcom], [2023.09.0], [[email protected]])
AC_INIT([microcom], [m4_esyscmd_s(cat VERSION)], [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([dist-xz])
Expand Down
Loading