Skip to content

chore(deps): update dependency no.liflig:snapshot-test to v1.20240422… #819

chore(deps): update dependency no.liflig:snapshot-test to v1.20240422…

chore(deps): update dependency no.liflig:snapshot-test to v1.20240422… #819

Workflow file for this run

name: ci
on:
push:
branches:
- "**"
defaults:
run:
shell: bash
jobs:
get-runner-user:
runs-on: ubuntu-22.04
outputs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "uid_gid=$(id -u):$(id -g)" >> "$GITHUB_OUTPUT"
build-and-deploy:
needs: get-runner-user
runs-on: ubuntu-22.04
container:
image: "public.ecr.aws/z8l5l4v4/buildtools/tool/maven:3-jdk-11-alpine"
options: --user ${{ needs.get-runner-user.outputs.uid_gid }}
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-
- name: store branch name in environment
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF##*/})" >> "$GITHUB_ENV"
- name: git config
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: configure maven
run: |
mkdir -p "$HOME/.m2"
cat <<EOF > "$HOME/.m2/settings.xml"
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>github</id>
<username>\${env.GITHUB_ACTOR}</username>
<password>\${env.GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
EOF
- name: conditional release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export MAVEN_OPTS="-Duser.home=$HOME" # Home directory not automatically picked up for some reason
major_version="$(sed -n "s/^.*<major-version>\([0-9]\{1,\}\)<\/major-version>.*$/\1/p" pom.xml)"
date="$(date -u "+%Y%m%d.%H%M%S")"
tag="$major_version.$date"
printf "Tag to use for potential release: %s\n" "$tag"
mvn -B org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce -Drules=requireReleaseDeps
release="false"
git fetch --tags
if [ "$BRANCH_NAME" = "master" ]; then
latest_tag="$(git describe --abbrev=0 || true)"
latest_tag_commit="$(if test -n "$latest_tag"; then git rev-parse "$latest_tag^{}"; fi)"
if [ ! "$latest_tag_commit" = "$GITHUB_SHA" ]; then
release="true"
fi
fi
if [ "$release" = "true" ]; then
# Release to GitHub Packages
mvn -B source:jar deploy scm:tag -DaltReleaseDeploymentRepository="github::default::https://maven.pkg.github.com/capralifecycle/liflig-logging" -Drevision="$tag" -Dtag="$tag"
else
mvn -B source:jar verify -Drevision="$tag" -Dtag="$tag"
fi