chore(deps): update flyway.version to v10.9.1 #826
Workflow file for this run
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: 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/docker/library/maven:3-eclipse-temurin-17" | |
options: --user ${{ needs.get-runner-user.outputs.uid_gid }} | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- 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-document-store" -Drevision="$tag" -Dtag="$tag" | |
else | |
mvn -B source:jar verify -Drevision="$tag" -Dtag="$tag" | |
fi |