From 93d80d1b7d14d2d9c6ff104b6ccbd3187de77d65 Mon Sep 17 00:00:00 2001 From: Elias Lundell <36220731+LogFlames@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:44:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20=F0=9F=91=B7=20docs:=20ci:=20Doc?= =?UTF-8?q?ument=20and=20update=20syncronizing=20lockfile=20with=20release?= =?UTF-8?q?=20(#1047)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: LogFlames --- .github/workflows/jreleaser.yml | 13 ++----------- README.md | 14 ++++++++++++++ action.yml | 2 +- template/action.yml | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/jreleaser.yml b/.github/workflows/jreleaser.yml index 6dfc4960..591f92f6 100644 --- a/.github/workflows/jreleaser.yml +++ b/.github/workflows/jreleaser.yml @@ -38,9 +38,6 @@ jobs: uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5 with: maven-version: 3.9.6 - - id: install-jbang - run: curl -Ls https://sh.jbang.dev | bash -s - app setup - shell: bash - name: Set git user run: | git config --global user.name "GitHub Actions Bot" @@ -78,10 +75,7 @@ jobs: - name: Generate Readme run : mvn generate-resources resources:copy-resources - name: run maven-lockfile (generate new lockfile for release version) - env: - POM_CHANGED: true # the version has changed, new lockfile is needed - COMMIT_UPDATED_LOCKFILE: true - run: ~/.jbang/bin/jbang --repos 'mavencentral' io.github.chains-project:maven-lockfile-github-action:5.3.5 + run: mvn io.github.chains-project:maven-lockfile:5.3.5:generate shell: bash - name: commit changes run: | @@ -130,10 +124,7 @@ jobs: - name: Generate Readme run : mvn generate-resources resources:copy-resources -q - name: run maven-lockfile (generate new lockfile for -SNAPSHOT version) - env: - POM_CHANGED: true # the version has changed, new lockfile is needed - COMMIT_UPDATED_LOCKFILE: true - run: ~/.jbang/bin/jbang --repos 'mavencentral' io.github.chains-project:maven-lockfile-github-action:5.3.5 + run: mvn io.github.chains-project:maven-lockfile:5.3.5:generate shell: bash # Commit and push changes - name: Commit & Push changes diff --git a/README.md b/README.md index c4fea02e..3dc3dbf8 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,20 @@ It still works for pull requests from the same repository. Renovate also works w - `lockfile-name` (optional, default="lockfile.json"): The name of the lockfile to generate/validate. - `workflow-filename` (optional, default='Lockfile.yml'): The name of the workflow file, to automatically trigger lockfile generation when the workflow is updated. +### Using Action in Release with `-SNAPSHOT`-versions (synchronizing lockfile with release) + +If you are updating your POM.xml during your release (e.g. by using `mvn version:set`) to remove `-SNAPSHOT` suffixes or increase the version during the release process the lockfile will need to be regenerated as well or the commit tagged with the release will contain a lockfile with the wrong version. +If you are setting the `-SNAPSHOT` version in the release action/script as well it is a good idea to update the lockfile to avoid a separate `chore: lockfile` commit. + +As an example, the steps for the CI in maven-lockfile is: +* set the version from `X.Y.Z-SNAPSHOT` to `X.Y.Z` in `pom.xml` +* run maven-lockfile using `mvn io.github.chains-project:maven-lockfile:5.3.5:generate` +* build and release +* create `Releasing version X.Y.Z` commit and tag it with `vX.Y.Z` +* set the version to `X.Y.(Z+1)-SNAPSHOT` in `pom.xml` +* run maven-lockfile using `mvn io.github.chains-project:maven-lockfile:5.3.5:generate` +* create `Setting SNAPSHOT version X.Y.(Z+1)-SNAPSHOT` commit + ## Related work Here we list some related work that we found while researching this topic. diff --git a/action.yml b/action.yml index e7853ea2..fbf82f8e 100644 --- a/action.yml +++ b/action.yml @@ -45,7 +45,7 @@ runs: with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} - repository: ${{github.event.pull_request.head.repo.full_name}} + repository: ${{ github.event.pull_request.head.repo.full_name }} token: ${{ inputs.github-token }} - name: Setup Java uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 diff --git a/template/action.yml b/template/action.yml index 5d1f54b6..959e54ed 100644 --- a/template/action.yml +++ b/template/action.yml @@ -45,7 +45,7 @@ runs: with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} - repository: ${{github.event.pull_request.head.repo.full_name}} + repository: ${{ github.event.pull_request.head.repo.full_name }} token: ${{ inputs.github-token }} - name: Setup Java uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4