From a227cdff578fcc055a40a9be5ac72feba6be615b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mich=C3=A8le=20BARRE?= Date: Fri, 5 Nov 2021 10:59:43 +1100 Subject: [PATCH] fix(deploy): deploiement de l'artefact dans github registry --- .github/workflows/maven-build.yml | 2 +- .github/workflows/maven-deploy.sh | 19 +++++++++++++++++++ .github/workflows/maven-publish.yml | 27 --------------------------- .releaserc | 12 +++++++----- 4 files changed, 27 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/maven-deploy.sh delete mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 4b6eebf..f566ee6 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -43,4 +43,4 @@ jobs: - name: Run semantic release to bump version and create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx semantic-release --skip-maven-deploy + run: npx semantic-release diff --git a/.github/workflows/maven-deploy.sh b/.github/workflows/maven-deploy.sh new file mode 100644 index 0000000..bfaee12 --- /dev/null +++ b/.github/workflows/maven-deploy.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "version = $1" + +# Get version number from version tag +JAR_VERSION=`echo $1 | cut -d'v' -f2` +echo "jar = $JAR_VERSION" + +# Set new library version in pom.xml using mvn versions:set command +# These new pom.xml and changelog.md generated by @semantic-release/changelog +# will be commit it by @semantic-release/git +mvn versions:set -DnewVersion=$JAR_VERSION && + +# Package the new library version and copy it to release folder +# These files will be upload to github by @semantic-release/github +java -version +mvn -B deploy -DskipTests && +mkdir release && +cp target/opt-logging-*.jar release diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml deleted file mode 100644 index d0dcc8e..0000000 --- a/.github/workflows/maven-publish.yml +++ /dev/null @@ -1,27 +0,0 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path - -name: Publish to Github Maven Registry - -on: - release: - types: [published, created, released] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - cache: 'maven' - - - name: Publish to GitHub Packages Apache Maven - run: mvn --batch-mode deploy - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.releaserc b/.releaserc index e993f94..7397a02 100644 --- a/.releaserc +++ b/.releaserc @@ -4,14 +4,16 @@ "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", - "@conveyal/maven-semantic-release", - "@semantic-release/github", + [ + "@semantic-release/exec", + { + "prepareCmd": ".github/workflows/maven-deploy.sh ${nextRelease.version}" + } + ], [ "@semantic-release/git", { - "assets": [ - "pom.xml" - ], + "assets": ["pom.xml"], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } ]