mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-26 02:33:02 +02:00
Prevent patch releases from stealing the "latest" tag from newer minor versions. Only vXX.YY and vXX.YY.0 releases should be marked as latest. Fixes #1187 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
131 lines
4.2 KiB
YAML
131 lines
4.2 KiB
YAML
# This job can be started by a git tag or using the workflow dispatch.
|
|
#
|
|
# The version string *must* be of the format: vYY.MM(-alphaN|-betaN|-rcN)
|
|
#
|
|
# In /etc/os-release this string is used for VERSION, VERSION_ID, and
|
|
# IMAGE_VERSION, with the 'v' prefix. In release artifact filenames,
|
|
# and zip file directory names, the 'v' is dropped per convention.
|
|
name: Release General
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]*.*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
set-version:
|
|
if: github.repository == 'kernelkit/infix' && startsWith(github.ref, 'refs/tags/')
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.set-ver.outputs.version }}
|
|
steps:
|
|
- id: set-ver
|
|
run: |
|
|
if [ -n "${{ inputs.version }}" ]; then
|
|
ver=${{ inputs.version }}
|
|
else
|
|
ver=${GITHUB_REF#refs/tags/}
|
|
fi
|
|
echo "version=${ver}" >> $GITHUB_OUTPUT
|
|
|
|
build:
|
|
needs: set-version
|
|
uses: ./.github/workflows/build-release.yml
|
|
with:
|
|
version: ${{ needs.set-version.outputs.version }}
|
|
use_cache: true
|
|
|
|
release:
|
|
name: Release Infix ${{ github.ref_name }}
|
|
needs: build
|
|
runs-on: [self-hosted, release]
|
|
permissions:
|
|
contents: write
|
|
discussions: write
|
|
steps:
|
|
- name: Cleanup podman state
|
|
run: |
|
|
set -x
|
|
podman ps -a || true
|
|
podman stop -a || true
|
|
podman rm -a -f || true
|
|
podman volume prune -f || true
|
|
podman system prune -a -f || true
|
|
podman system migrate || true
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'true'
|
|
|
|
- name: Set Release Variables
|
|
id: rel
|
|
run: |
|
|
if [ -n "${{ inputs.version }}" ]; then
|
|
ver=${{ inputs.version }}
|
|
else
|
|
ver=${GITHUB_REF#refs/tags/}
|
|
fi
|
|
echo "ver=${ver}" >> $GITHUB_OUTPUT
|
|
echo "cat=" >> $GITHUB_OUTPUT
|
|
if echo $ver | grep -qE 'v[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then
|
|
echo "pre=true" >> $GITHUB_OUTPUT
|
|
echo "latest=false" >> $GITHUB_OUTPUT
|
|
elif echo $ver | grep -qE '^v[0-9]+\.[0-9]+(\.0)?$'; then
|
|
echo "pre=false" >> $GITHUB_OUTPUT
|
|
echo "latest=true" >> $GITHUB_OUTPUT
|
|
echo "cat=Releases" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "pre=false" >> $GITHUB_OUTPUT
|
|
echo "latest=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
echo "pre=${{ steps.rel.outputs.pre }}"
|
|
echo "latest=${{ steps.rel.outputs.latest }}"
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: "artifact-*"
|
|
merge-multiple: true
|
|
|
|
- name: Create checksums ...
|
|
run: |
|
|
for file in *.tar.gz; do
|
|
sha256sum $file > $file.sha256
|
|
done
|
|
if ls *.qcow2 &>/dev/null; then
|
|
for file in *.qcow2; do
|
|
sha256sum "$file" > "$file.sha256"
|
|
done
|
|
fi
|
|
|
|
- name: Extract ChangeLog entry ...
|
|
run: |
|
|
awk '/^-----*$/{if (x == 1) exit; x=1;next}x' doc/ChangeLog.md \
|
|
|head -n -1 > release.md
|
|
echo "" >> release.md
|
|
echo "> [!TIP]" >> release.md
|
|
echo "> **Try Infix in GNS3!** Download the appliance from the [GNS3 Marketplace](https://gns3.com/marketplace/appliances/infix) to test Infix in a virtual network environment without hardware." >> release.md
|
|
cat release.md
|
|
|
|
- uses: ncipollo/release-action@v1
|
|
with:
|
|
name: Infix ${{ github.ref_name }}
|
|
prerelease: ${{ steps.rel.outputs.pre }}
|
|
makeLatest: ${{ steps.rel.outputs.latest }}
|
|
discussionCategory: ${{ steps.rel.outputs.cat }}
|
|
bodyFile: release.md
|
|
artifacts: "*.tar.gz*,*.qcow2*"
|
|
|
|
- name: Summary
|
|
run: |
|
|
cat <<EOF >> $GITHUB_STEP_SUMMARY
|
|
# Infix ${{ github.ref_name }} Released! :rocket:
|
|
|
|
For the public download links of this release, please see:
|
|
<https://github.com/kernelkit/infix/releases/tag/${{ github.ref_name }}>
|
|
EOF
|