Skip to content

Commit

Permalink
Make Update target a shared workflow and move configuration into pom
Browse files Browse the repository at this point in the history
The workflow to update the target file is quite convenient and proven to
work well.

This now moves the configuration into the pom and makes the workflow a
shared one so it can be used in other projects easily.
  • Loading branch information
laeubi committed Jan 26, 2025
1 parent 03dddb8 commit cf32057
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 17 deletions.
34 changes: 33 additions & 1 deletion .github/workflows/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,36 @@ It checks all artifacts that match the provided range and suggest a lower bound

Workflow that could be used as a timed action to check if any automatic code cleanup can be performed.
Actions to perform must be defined in the configuration of the [quickfix-and-cleanup-mojo](https://github.com/eclipse-tycho/tycho/blob/main/RELEASE_NOTES.md#new-quickfix-and-cleanup-mojo)
that is called by this action. For this purpose it uses the follwoing execution ids `cleanups` and `quickfixes`
that is called by this action. For this purpose it uses the follwoing execution ids `cleanups` and `quickfixes`

## updateTarget.yml

A Workflow that automatically checks a target file for updates of its dependencies.

It has the follwoing inputs:
- author - desired commit author / email
- token - token to use to create the PR while this action can work without it, it is recommended to use a PAT if used as a timed action because otherwhise PR checks can't run, see [here](https://github.com/marketplace/actions/create-pull-request#token) for details.
- path - path to a project that contains the target to update

and exspect that the pom configures an execution named `update-target` for its configuration, or otherwhise is running with the defaults.
An example might look like this:

```
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-version-bump-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<id>update-target</id>
<configuration>
<allowMajorUpdates>false</allowMajorUpdates>
<updateSiteDiscovery>parent</updateSiteDiscovery>
<mavenRulesUri>${project.basedir}/update-rules.xml</mavenRulesUri>
</configuration>
</execution>
</executions>
</plugin>
```

See the [tycho-version-bump:update-target](https://tycho.eclipseprojects.io/doc/latest/tycho-extras/tycho-version-bump-plugin/update-target-mojo.html) for further details.
25 changes: 25 additions & 0 deletions .github/workflows/callUpdateTarget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check for Target Platform updates

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
schedule:
- cron: '0 */2 * * *'
push:
branches:
- master
paths:
- '**.target'


jobs:
update:
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/updateTarget.yml@master
with:
author: Eclipse Releng Bot <[email protected]>
path: 'eclipse.platform.releng.prereqs.sdk'
secrets:
token: ${{ secrets.RELENG_BOT_PAT }}
37 changes: 21 additions & 16 deletions .github/workflows/updateTarget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ concurrency:
cancel-in-progress: true

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- master
paths:
- '**.target'
workflow_call:
inputs:
author:
description: Defines the committer / author that should be used for the commit
required: false
type: string
default: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
path:
description: Defines the committer / author that should be used for the commit
required: true
type: string
secrets:
token:
description: Personal Access Token to use for creating pull-requests
required: false
default: ${{ secrets.GITHUB_TOKEN }}
jobs:
update:
runs-on: ubuntu-latest
Expand All @@ -33,11 +41,8 @@ jobs:
cache: maven
- name: Update Target Platform
run: >-
mvn -ntp -f eclipse.platform.releng.prereqs.sdk
org.eclipse.tycho.extras:tycho-version-bump-plugin:4.0.9:update-target
-DallowMajorUpdates=false
-Ddiscovery=parent
-Dmaven.version.rules=update-rules.xml
mvn -ntp -f ${{ inputs.path }}
tycho-version-bump:update-target@update-target
- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
Expand All @@ -47,8 +52,8 @@ jobs:
body: Please review the changes and merge if appropriate, or cherry pick individual updates.
delete-branch: true
draft: false
token: ${{ secrets.RELENG_BOT_PAT }}
committer: Eclipse Releng Bot <[email protected]>
author: Eclipse Releng Bot <[email protected]>
token: ${{ secrets.token }}
committer: ${{ inputs.author }}
author: ${{ inputs.author }}
add-paths: |
**/*.target
15 changes: 15 additions & 0 deletions eclipse-platform-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,21 @@
<artifactId>tycho-versions-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-version-bump-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<id>update-target</id>
<configuration>
<allowMajorUpdates>false</allowMajorUpdates>
<updateSiteDiscovery>parent</updateSiteDiscovery>
<mavenRulesUri>${project.basedir}/update-rules.xml</mavenRulesUri>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-cleancode-plugin</artifactId>
Expand Down

0 comments on commit cf32057

Please sign in to comment.