Check for repository variable (#19) #13
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: Rebuild latest release image version | |
on: | |
schedule: | |
- cron: 0 0 * * 1 | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
jobs: | |
rebuild: | |
name: Rebuild latest release image version | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout main fcrepo repository" | |
uses: actions/checkout@v3 | |
with: | |
repository: "fcrepo/fcrepo" | |
- name: "Checkout fcrepo Docker repository" | |
uses: actions/checkout@v3 | |
with: | |
path: "fcrepo-docker" | |
- name: "Check for preset tag" | |
run: | | |
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 | |
with: | |
distribution: "temurin" | |
java-version: 11 | |
cache: "maven" | |
- name: "Build fcrepo WAR" | |
run: | | |
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=${{ 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" |