Skip to content

Commit

Permalink
Check for repository variable (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
whikloj authored Jan 25, 2024
1 parent dec979e commit 58dc7bd
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/rebuild-latest-stable-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ jobs:
with:
path: "fcrepo-docker"

- name: "Get latest release version"
id: get_latest_version
- name: "Check for preset tag"
run: |
# https://github.com/actions/checkout/issues/701
git fetch --tags origin --unshallow
LATEST_RELEASE_TAG=$(git describe --abbrev=0 --exclude="*RC*")
echo "latest_release_tag=$LATEST_RELEASE_TAG" >> $GITHUB_OUTPUT
echo "latest_release_version=${LATEST_RELEASE_TAG//fcrepo-/}" >> $GITHUB_OUTPUT
if [[ -n "${{ vars.FCREPO_SPECIAL_RELEASE_TAG}}" ]]; then
FCREPO_LATEST_RELEASE_TAG=${{ vars.FCREPO_SPECIAL_RELEASE_TAG }}
echo "FCREPO_LATEST_RELEASE_TAG=${FCREPO_LATEST_RELEASE_TAG}" >> $GITHUB_ENV
FCREPO_LATEST_RELEASE_VERSION=${FCREPO_LATEST_RELEASE_TAG//fcrepo-/}
echo "FCREPO_LATEST_RELEASE_VERSION=${FCREPO_LATEST_RELEASE_VERSION}" >> $GITHUB_ENV
else
# https://github.com/actions/checkout/issues/701
git fetch --tags origin --unshallow
LATEST_RELEASE_TAG=$(git describe --abbrev=0 --exclude="*RC*")
echo "FCREPO_LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV
echo "FCREPO_LATEST_RELEASE_VERSION=${LATEST_RELEASE_TAG//fcrepo-/}" >> $GITHUB_ENV
fi
- name: Set up JDK 11
uses: actions/setup-java@v2
Expand All @@ -42,16 +47,17 @@ jobs:

- name: "Build fcrepo WAR"
run: |
git checkout "${{ steps.get_latest_version.outputs.latest_release_tag }}"
git checkout "${{ env.FCREPO_LATEST_RELEASE_TAG }}"
mvn -B -U clean install
- name: "Build Docker image"
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
cd fcrepo-docker
LATEST_RELEASE_VERSION=${{ steps.get_latest_version.outputs.latest_release_version }}
LATEST_RELEASE_VERSION=${{ env.FCREPO_LATEST_RELEASE_VERSION }}
VERSION_PARTS=( ${LATEST_RELEASE_VERSION//./ } )
./build-and-push-to-dockerhub.sh ../fcrepo-webapp/target/fcrepo-webapp-$LATEST_RELEASE_VERSION.war "${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}-tomcat9" "${VERSION_PARTS[0]}.${VERSION_PARTS[1]}-tomcat9" "${VERSION_PARTS[0]}-tomcat9"

0 comments on commit 58dc7bd

Please sign in to comment.