Update maven #259
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update maven | |
"on": | |
schedule: | |
- cron: 0 5 * * 1-5 | |
workflow_dispatch: {} | |
jobs: | |
update: | |
name: Update Build Module Dependency | |
runs-on: | |
- ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Install update-buildmodule-dependency | |
run: | | |
#!/usr/bin/env bash | |
set -euo pipefail | |
go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildmodule-dependency@${PAKETO_LIBPAK_COMMIT:=latest} | |
env: | |
PAKETO_LIBPAK_COMMIT: ${{ vars.PAKETO_LIBPAK_COMMIT }} | |
- name: Install yj | |
run: | | |
#!/usr/bin/env bash | |
set -euo pipefail | |
echo "Installing yj ${YJ_VERSION}" | |
mkdir -p "${HOME}"/bin | |
echo "${HOME}/bin" >> "${GITHUB_PATH}" | |
curl \ | |
--location \ | |
--show-error \ | |
--silent \ | |
--output "${HOME}"/bin/yj \ | |
"https://github.com/sclevine/yj/releases/download/v${YJ_VERSION}/yj-linux" | |
chmod +x "${HOME}"/bin/yj | |
env: | |
YJ_VERSION: 5.0.0 | |
- uses: actions/checkout@v3 | |
- id: dependency | |
uses: docker://ghcr.io/paketo-buildpacks/actions/maven-dependency:main | |
with: | |
artifact_id: apache-maven | |
classifier: bin | |
group_id: org.apache.maven | |
packaging: tar.gz | |
uri: https://repo1.maven.org/maven2 | |
- name: Update BuildModule Dependency | |
id: buildmodule | |
run: | | |
#!/usr/bin/env bash | |
set -euo pipefail | |
if [[ "${EXTENSION:-x}" == "true" ]]; then | |
export PACK_MODULE_TYPE=extension | |
else | |
export PACK_MODULE_TYPE=buildpack | |
fi | |
OLD_VERSION=$(yj -tj < ${PACK_MODULE_TYPE}.toml | jq -r " | |
.metadata.dependencies[] | | |
select( .id == env.ID ) | | |
select( .version | test( env.VERSION_PATTERN ) ) | | |
.version") | |
update-buildmodule-dependency \ | |
--buildmodule-toml ${PACK_MODULE_TYPE}.toml \ | |
--id "${ID}" \ | |
--version-pattern "${VERSION_PATTERN}" \ | |
--version "${VERSION}" \ | |
--cpe-pattern "${CPE_PATTERN:-}" \ | |
--cpe "${CPE:-}" \ | |
--purl-pattern "${PURL_PATTERN:-}" \ | |
--purl "${PURL:-}" \ | |
--uri "${URI}" \ | |
--sha256 "${SHA256}" | |
git add ${PACK_MODULE_TYPE}.toml | |
git checkout -- . | |
if [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $1}')" != "$(echo "$VERSION" | awk -F '.' '{print $1}')" ]; then | |
LABEL="semver:major" | |
elif [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $2}')" != "$(echo "$VERSION" | awk -F '.' '{print $2}')" ]; then | |
LABEL="semver:minor" | |
else | |
LABEL="semver:patch" | |
fi | |
echo "old-version=${OLD_VERSION}" >> "$GITHUB_OUTPUT" | |
echo "new-version=${VERSION}" >> "$GITHUB_OUTPUT" | |
echo "version-label=${LABEL}" >> "$GITHUB_OUTPUT" | |
env: | |
CPE: ${{ steps.dependency.outputs.cpe }} | |
CPE_PATTERN: "" | |
EXTENSION: "true" | |
ID: maven | |
PURL: ${{ steps.dependency.outputs.purl }} | |
PURL_PATTERN: "" | |
SHA256: ${{ steps.dependency.outputs.sha256 }} | |
URI: ${{ steps.dependency.outputs.uri }} | |
VERSION: ${{ steps.dependency.outputs.version }} | |
VERSION_PATTERN: '[\d]+\.[\d]+\.[\d]+' | |
- uses: peter-evans/create-pull-request@v5 | |
with: | |
author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> | |
body: Bumps `maven` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildmodule.outputs.new-version }}`. | |
branch: update/buildmodule/maven | |
commit-message: |- | |
Bump maven from ${{ steps.buildmodule.outputs.old-version }} to ${{ steps.buildmodule.outputs.new-version }} | |
Bumps maven from ${{ steps.buildmodule.outputs.old-version }} to ${{ steps.buildmodule.outputs.new-version }}. | |
delete-branch: true | |
labels: ${{ steps.buildmodule.outputs.version-label }}, type:dependency-upgrade | |
signoff: true | |
title: Bump maven from ${{ steps.buildmodule.outputs.old-version }} to ${{ steps.buildmodule.outputs.new-version }} | |
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} |