From 1125c2f3ec776059c5abff5345c0921ac50d4674 Mon Sep 17 00:00:00 2001 From: tison Date: Fri, 6 Jan 2023 16:02:34 +0800 Subject: [PATCH] build(maven): Try preparationGoals and completionGoals (#27) Signed-off-by: tison --- .gitignore | 3 ++ action.yml | 2 +- distribution/commandline/pom.xml | 1 + distribution/native/pom.xml | 15 ++++++ distribution/pom.xml | 2 + distribution/releasehelper/pom.xml | 82 ++++++++++++++++++++++++++++++ pom.xml | 59 ++++++++++++++++++++- tools/update-action-image-url.py | 33 ++++++++++++ 8 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 distribution/releasehelper/pom.xml create mode 100755 tools/update-action-image-url.py diff --git a/.gitignore b/.gitignore index 56132fcc..b8cdd672 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ build/ ### Mac OS ### .DS_Store + +### Build ### +action.yml.bak diff --git a/action.yml b/action.yml index 9003505f..1edd5351 100644 --- a/action.yml +++ b/action.yml @@ -33,7 +33,7 @@ inputs: runs: using: docker - image: docker://ghcr.io/korandoru/hawkeye-native + image: docker://ghcr.io/korandoru/hawkeye-native:latest args: - ${{ inputs.mode }} - --config diff --git a/distribution/commandline/pom.xml b/distribution/commandline/pom.xml index 630efe7b..13bea621 100644 --- a/distribution/commandline/pom.xml +++ b/distribution/commandline/pom.xml @@ -25,6 +25,7 @@ HawkEye :: Distribution :: Command Line Interface + HawkEye command-line executables commandline diff --git a/distribution/native/pom.xml b/distribution/native/pom.xml index 4e19d00b..d5c6c45e 100644 --- a/distribution/native/pom.xml +++ b/distribution/native/pom.xml @@ -71,5 +71,20 @@ + + release + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + true + + + + + diff --git a/distribution/pom.xml b/distribution/pom.xml index c195f35e..cfe560a2 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -25,6 +25,7 @@ HawkEye :: Distribution + HawkEye distributions distribution pom @@ -32,5 +33,6 @@ commandline native + releasehelper diff --git a/distribution/releasehelper/pom.xml b/distribution/releasehelper/pom.xml new file mode 100644 index 00000000..46559b07 --- /dev/null +++ b/distribution/releasehelper/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + io.korandoru.hawkeye + distribution + 1.0.3-SNAPSHOT + + + HawkEye :: Distribution :: Release Helper + releasehelper + + pom + + + + + + org.codehaus.mojo + exec-maven-plugin + + false + + + + before-prepare-release + + exec + + + v${project.version} + + + + after-prepare-release + + exec + + + latest + + + + + + + + + + release + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + true + + + + + + + diff --git a/pom.xml b/pom.xml index 1d8be25c..008e7141 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,7 @@ 3.3.0 3.0.0-M6 + 2.0.0-M3 3.4.1 3.0.0-M7 @@ -184,11 +185,21 @@ org.codehaus.mojo ${exec-maven-plugin.version} + + org.apache.maven.plugins + maven-scm-plugin + ${maven-scm-plugin.version} + org.apache.maven.plugins maven-shade-plugin ${maven-shade-plugin.version} + + org.apache.maven.plugins + maven-release-plugin + ${maven-release-plugin.version} + org.sonatype.plugins nexus-staging-maven-plugin @@ -234,15 +245,61 @@ + + org.codehaus.mojo + exec-maven-plugin + + ${maven.multiModuleProjectDirectory}/tools/update-action-image-url.py + true + + + + before-prepare-release + + + after-prepare-release + + + + + + org.apache.maven.plugins + maven-scm-plugin + + + add-action-yml + + add + + + ${project.basedir} + false + action.yml + + + + + org.apache.maven.plugins maven-release-plugin - ${maven-release-plugin.version} true false release deploy + + clean + verify + exec:exec@before-prepare-release + scm:add@add-action-yml + + + clean + package + exec:exec@after-prepare-release + scm:add@add-action-yml + true v@{project.version} ci(release): diff --git a/tools/update-action-image-url.py b/tools/update-action-image-url.py new file mode 100755 index 00000000..be9fa4aa --- /dev/null +++ b/tools/update-action-image-url.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# Copyright 2023 Korandoru Contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import fileinput +import re + +from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser +from pathlib import Path + + +if __name__ == '__main__': + parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter) + parser.add_argument('version', default='latest', nargs='?', help='version of hawkeye-native image') + args = parser.parse_args() + + pattern = re.compile(r'docker://ghcr.io/korandoru/hawkeye-native.*') + basedir = Path(__file__).parent.parent.absolute() + with fileinput.FileInput(basedir / 'action.yml', inplace=True, backup='.bak') as content: + for line in content: + print(pattern.sub(f'docker://ghcr.io/korandoru/hawkeye-native:{args.version}', line), end='')