Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github actions #4

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,44 @@ jobs:
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

# container-image:
# if: github.repository_owner == 'opentransportro' && github.event_name == 'push' && (github.ref == 'refs/heads/main')
# runs-on: ubuntu-latest
# needs:
# - build
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: 17
# distribution: temurin
# cache: maven
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# - name: Build container image with Jib, push to Dockerhub
# env:
# CONTAINER_REPO: docker.io/otrro/transitclock-server
# CONTAINER_REGISTRY_USER: ${{secrets.DOCKER_USER}}
# CONTAINER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_AUTH }}
# run: |
# # we give the container two tags
# # - "latest"
# # - a string like "2.3_2022-12-12T21-38"
#
# version_with_snapshot=`mvn -q help:evaluate -Dexpression=project.version -q -DforceStdout`
# version=${version_with_snapshot/-SNAPSHOT/}
#
# image_version=${version}
#
# ## if the Maven version contains SNAPSHOT, then add date to tag
# if [[ $version_with_snapshot == *"SNAPSHOT"* ]]; then
# image_date=`date +%Y-%m-%dT%H-%M`
# image_version="${version}_${image_date}"
# echo "Maven version ${version_with_snapshot} contains SNAPSHOT, adding date to container image tag"
# fi
#
# mvn install jib:build -Djib.to.tags=latest,$image_version
container-image:
if: github.repository_owner == 'goeuropa' && github.event_name == 'push' && (github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: maven
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Build container image with Jib, push to Dockerhub
env:
CONTAINER_REPO: docker.io/wkulesza/transitclock-server
CONTAINER_REGISTRY_USER: ${{secrets.DOCKER_USER}}
CONTAINER_REGISTRY_PASSWORD: ${{secrets.DOCKER_AUTH}}
run: |
# we give the container two tags
# - "latest"
# - a string like "2.3_2022-12-12T21-38"
version_with_snapshot=`mvn -q help:evaluate -Dexpression=project.version -q -DforceStdout`
version=${version_with_snapshot/-SNAPSHOT/}
image_version=${version}
## if the Maven version contains SNAPSHOT, then add date to tag
if [[ $version_with_snapshot == *"SNAPSHOT"* ]]; then
image_date=`date +%Y-%m-%dT%H-%M`
image_version="${version}_${image_date}"
echo "Maven version ${version_with_snapshot} contains SNAPSHOT, adding date to container image tag"
fi
mvn install jib:build -Djib.to.tags=latest,$image_version
Loading