Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 👷 docs: ci: Document and update syncronizing lockfile with release #1047

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/workflows/jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion template/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading