Skip to content

Commit

Permalink
Regularly rebuild image of latest release (#17)
Browse files Browse the repository at this point in the history
FCREPO-3849: Regularly rebuild image of latest release
  • Loading branch information
andyundso authored Oct 5, 2023
1 parent d7c69a4 commit c5fd515
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/rebuild-latest-stable-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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: "Get latest release version"
id: get_latest_version
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
- 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 "${{ steps.get_latest_version.outputs.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 }}
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 c5fd515

Please sign in to comment.