mirror of https://github.com/xemu-project/xemu.git
.github: Make all release tags follow v<semver> convention
Replace xemu-v*, gh-release/* tagging with typical semver vX.Y.Z, which plays nicer with GitHub releases. Increments patch version on push to master.
This commit is contained in:
parent
292c9703de
commit
a809d8557d
|
@ -21,6 +21,26 @@ jobs:
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
# On push to master, increment patch version and create a new tag on release
|
||||||
|
- name: Increment patch version
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
run: |
|
||||||
|
git config user.name "nobody"
|
||||||
|
git config user.email "nobody@nowhere"
|
||||||
|
VERSION=$(git describe --tags --match 'v*' --abbrev=0 | xargs ./scripts/increment-semver.py)
|
||||||
|
git tag -a $VERSION -m $VERSION
|
||||||
|
echo "Generated new release version: $VERSION"
|
||||||
|
# GitHub treats the new tag as lightweight, so older tags will shadow the
|
||||||
|
# new tag. Recreate it as an annotated tag now so the version script picks
|
||||||
|
# it up properly.
|
||||||
|
- name: Annotate release tag
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||||
|
run: |
|
||||||
|
git config user.name "nobody"
|
||||||
|
git config user.email "nobody@nowhere"
|
||||||
|
VERSION=${GITHUB_REF/refs\/tags\//}
|
||||||
|
git tag -a -f $VERSION $VERSION -m $VERSION
|
||||||
|
echo "Recreated release tag: $VERSION"
|
||||||
- name: Create source package
|
- name: Create source package
|
||||||
run: |
|
run: |
|
||||||
./scripts/archive-source.sh src.tar
|
./scripts/archive-source.sh src.tar
|
||||||
|
@ -280,7 +300,7 @@ jobs:
|
||||||
path: xemu-macos-universal-${{ matrix.configuration }}.zip
|
path: xemu-macos-universal-${{ matrix.configuration }}.zip
|
||||||
|
|
||||||
Release:
|
Release:
|
||||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/xemu-v'))
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [Ubuntu, macOSUniversal, Windows]
|
needs: [Ubuntu, macOSUniversal, Windows]
|
||||||
steps:
|
steps:
|
||||||
|
@ -293,21 +313,15 @@ jobs:
|
||||||
- name: Get release info
|
- name: Get release info
|
||||||
run: |
|
run: |
|
||||||
echo "XEMU_VERSION=$(cat XEMU_VERSION)" >> $GITHUB_ENV
|
echo "XEMU_VERSION=$(cat XEMU_VERSION)" >> $GITHUB_ENV
|
||||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
||||||
echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
# GitHub requires a tag to make a release, but this is not a tagged
|
|
||||||
# update. Generate a new tag.
|
|
||||||
echo "TAG_NAME=gh-release/$(cat XEMU_VERSION)" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
- name: Publish release
|
- name: Publish release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ env.TAG_NAME }}
|
tag_name: v${{ env.XEMU_VERSION }}
|
||||||
name: ${{ env.XEMU_VERSION }}
|
name: v${{ env.XEMU_VERSION }}
|
||||||
prerelease: false
|
prerelease: false
|
||||||
draft: false
|
draft: false
|
||||||
files: |
|
files: |
|
||||||
|
dist/src.tar.gz/src.tar.gz
|
||||||
dist/xemu-win-debug/xemu-win-debug.zip
|
dist/xemu-win-debug/xemu-win-debug.zip
|
||||||
dist/xemu-win-release/xemu-win-release.zip
|
dist/xemu-win-release/xemu-win-release.zip
|
||||||
dist/xemu-macos-universal-release/xemu-macos-universal-release.zip
|
dist/xemu-macos-universal-release/xemu-macos-universal-release.zip
|
||||||
|
@ -319,7 +333,7 @@ jobs:
|
||||||
# package creation.
|
# package creation.
|
||||||
PushToPPA:
|
PushToPPA:
|
||||||
name: Push to PPA Snapshot Branch
|
name: Push to PPA Snapshot Branch
|
||||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/xemu-v'))
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
|
||||||
needs: [Ubuntu, macOSUniversal, Windows]
|
needs: [Ubuntu, macOSUniversal, Windows]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -76,7 +76,7 @@ done
|
||||||
|
|
||||||
git rev-parse HEAD 2>/dev/null | tr -d '\n' > XEMU_COMMIT
|
git rev-parse HEAD 2>/dev/null | tr -d '\n' > XEMU_COMMIT
|
||||||
git symbolic-ref --short HEAD > XEMU_BRANCH
|
git symbolic-ref --short HEAD > XEMU_BRANCH
|
||||||
git describe --tags --match 'xemu-v*' | cut -c 7- | tr -d '\n' > XEMU_VERSION
|
git describe --tags --match 'v*' | cut -c 2- | tr -d '\n' > XEMU_VERSION
|
||||||
tar -r --file "$tar_file" XEMU_COMMIT XEMU_BRANCH XEMU_VERSION
|
tar -r --file "$tar_file" XEMU_COMMIT XEMU_BRANCH XEMU_VERSION
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import argparse, re
|
||||||
|
ap = argparse.ArgumentParser()
|
||||||
|
ap.add_argument('semver', help='Input semver X.Y.Z')
|
||||||
|
args = ap.parse_args()
|
||||||
|
m = re.match(r'(?P<pfx>[^\d]*)(?P<maj>\d+)\.(?P<min>\d+)\.(?P<pat>\d+)',
|
||||||
|
args.semver)
|
||||||
|
assert m, 'Invalid version format'
|
||||||
|
print(m.group('pfx') + '.'.join([m.group('maj'), m.group('min'),
|
||||||
|
str(int(m.group('pat')) + 1)]))
|
|
@ -21,7 +21,7 @@ XEMU_BRANCH=$( \
|
||||||
XEMU_VERSION=$( \
|
XEMU_VERSION=$( \
|
||||||
cd "$dir"; \
|
cd "$dir"; \
|
||||||
if test -e .git; then \
|
if test -e .git; then \
|
||||||
git describe --tags --match 'xemu-v*' | cut -c 7- | tr -d '\n'; \
|
git describe --tags --match 'v*' | cut -c 2- | tr -d '\n'; \
|
||||||
elif test -e XEMU_VERSION; then \
|
elif test -e XEMU_VERSION; then \
|
||||||
cat XEMU_VERSION; \
|
cat XEMU_VERSION; \
|
||||||
fi)
|
fi)
|
||||||
|
@ -36,15 +36,15 @@ get_version_dot () {
|
||||||
|
|
||||||
XEMU_VERSION_MAJOR=$(get_version_dot 1)
|
XEMU_VERSION_MAJOR=$(get_version_dot 1)
|
||||||
XEMU_VERSION_MINOR=$(get_version_dot 2)
|
XEMU_VERSION_MINOR=$(get_version_dot 2)
|
||||||
XEMU_VERSION_MICRO=$(get_version_dot 3)
|
XEMU_VERSION_PATCH=$(get_version_dot 3)
|
||||||
XEMU_VERSION_PATCH=$(get_version_field 2)
|
XEMU_VERSION_COMMIT=$(get_version_field 2)
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
#define XEMU_VERSION "$XEMU_VERSION"
|
#define XEMU_VERSION "$XEMU_VERSION"
|
||||||
#define XEMU_VERSION_MAJOR $XEMU_VERSION_MAJOR
|
#define XEMU_VERSION_MAJOR $XEMU_VERSION_MAJOR
|
||||||
#define XEMU_VERSION_MINOR $XEMU_VERSION_MINOR
|
#define XEMU_VERSION_MINOR $XEMU_VERSION_MINOR
|
||||||
#define XEMU_VERSION_MICRO $XEMU_VERSION_MICRO
|
|
||||||
#define XEMU_VERSION_PATCH $XEMU_VERSION_PATCH
|
#define XEMU_VERSION_PATCH $XEMU_VERSION_PATCH
|
||||||
|
#define XEMU_VERSION_COMMIT $XEMU_VERSION_COMMIT
|
||||||
#define XEMU_BRANCH "$XEMU_BRANCH"
|
#define XEMU_BRANCH "$XEMU_BRANCH"
|
||||||
#define XEMU_COMMIT "$XEMU_COMMIT"
|
#define XEMU_COMMIT "$XEMU_COMMIT"
|
||||||
#define XEMU_DATE "$XEMU_DATE"
|
#define XEMU_DATE "$XEMU_DATE"
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
#include "xemu-version-macro.h"
|
#include "xemu-version-macro.h"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION XEMU_VERSION_MAJOR,XEMU_VERSION_MINOR,XEMU_VERSION_MICRO,XEMU_VERSION_PATCH
|
FILEVERSION XEMU_VERSION_MAJOR,XEMU_VERSION_MINOR,XEMU_VERSION_PATCH,XEMU_VERSION_COMMIT
|
||||||
PRODUCTVERSION XEMU_VERSION_MAJOR,XEMU_VERSION_MINOR,XEMU_VERSION_MICRO,XEMU_VERSION_PATCH
|
PRODUCTVERSION XEMU_VERSION_MAJOR,XEMU_VERSION_MINOR,XEMU_VERSION_PATCH,XEMU_VERSION_COMMIT
|
||||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
FILEOS VOS_NT_WINDOWS32
|
FILEOS VOS_NT_WINDOWS32
|
||||||
FILETYPE VFT_APP
|
FILETYPE VFT_APP
|
||||||
|
|
Loading…
Reference in New Issue