Update pom versions to 0.7.3 #77
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: odm-platform CI/CD | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
REGISTRY_IMAGE_NAME: odm-platform-registry | |
DEVOPS_IMAGE_NAME: odm-platform-devops | |
BLUEPRINT_IMAGE_NAME: odm-platform-blueprint | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/[email protected] | |
with: | |
ssh-key: ${{secrets.SSH_KEY}} | |
- name: Install SSH key # Install SSH key to connect to github repos | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: maven | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: Set env # Extract version and branch from tag and save them as environment variables | |
run: | | |
echo "TAG_VERSION=$( echo ${{github.ref_name}} | sed 's/[^0-9.]//g' )" >> $GITHUB_ENV | |
echo "BRANCH_NAME=$( echo ${{ github.event.base_ref }} | sed 's|refs/heads/||' )" >> $GITHUB_ENV | |
- name: Update versions | |
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.TAG_VERSION }} | |
- name: Push new version | |
run: | | |
git config user.name "github-workflows-version-updater" | |
git config user.email "<>" | |
git commit -am "Update pom versions to ${{ env.TAG_VERSION }}" | |
git push origin HEAD:${{ env.BRANCH_NAME }} | |
- name: Build with Maven | |
run: mvn -B clean package --file pom.xml | |
- name: Publish to GitHub Packages Apache Maven | |
run: mvn -DGitHubPackages=true -DskipTests deploy -s $GITHUB_WORKSPACE/settings.xml | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Build Docker images | |
run: | | |
docker build . --file Dockerfile --tag $REGISTRY_IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | |
docker build . --file product-plane-services/devops-server/Dockerfile --tag $DEVOPS_IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | |
docker build . --file product-plane-services/blueprint-server/Dockerfile --tag $BLUEPRINT_IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | |
- name: Login to Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push images to Container Registry | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/odm-platform-registry | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
docker tag $REGISTRY_IMAGE_NAME $IMAGE_ID:${{ env.TAG_VERSION }} | |
docker push $IMAGE_ID:${{ env.TAG_VERSION }} | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/odm-platform-devops | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
docker tag $DEVOPS_IMAGE_NAME $IMAGE_ID:${{ env.TAG_VERSION }} | |
docker push $IMAGE_ID:${{ env.TAG_VERSION }} | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/odm-platform-blueprint | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
docker tag $BLUEPRINT_IMAGE_NAME $IMAGE_ID:${{ env.TAG_VERSION }} | |
docker push $IMAGE_ID:${{ env.TAG_VERSION }} | |
- name: Docker login | |
env: | |
DOCKER_USER: ${{secrets.DOCKER_USERNAME}} | |
DOCKER_PWD: ${{secrets.DOCKER_PASSWORD}} | |
run: docker login -u $DOCKER_USER -p $DOCKER_PWD | |
- name: Docker build | |
run: | | |
docker build . --file Dockerfile --tag opendatamesh/odm-platform-registry:${{ env.TAG_VERSION }} | |
docker build . --file product-plane-services/devops-server/Dockerfile --tag opendatamesh/odm-platform-devops:${{ env.TAG_VERSION }} | |
docker build . --file product-plane-services/blueprint-server/Dockerfile --tag opendatamesh/odm-platform-blueprint:${{ env.TAG_VERSION }} | |
- name: Docker push | |
run: | | |
docker push opendatamesh/odm-platform-registry:${{ env.TAG_VERSION }} | |
docker push opendatamesh/odm-platform-devops:${{ env.TAG_VERSION }} | |
docker push opendatamesh/odm-platform-blueprint:${{ env.TAG_VERSION }} |