Skip to content

Commit

Permalink
Merge pull request #2 from Tobianas/Tobianas-patch-1
Browse files Browse the repository at this point in the history
Add Publish netconf-simulator
  • Loading branch information
Tobianas authored Dec 11, 2024
2 parents 14407fb + a557030 commit 2382d97
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
if: ${{ env.SONAR_TOKEN == 0 }}
run: mvn -B verify
- name: Upload surefire test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Surefire-Test-Results
path: ~/**/surefire-reports/**/*.txt
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/publish-simulator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Publish netconf-simulator
on:
workflow_dispatch:
inputs:
version:
description: Desired version of published docker image & helm charts, e.g. "XX.YY.ZZ"
required: true
checkout-ref:
description: The branch, tag or SHA to checkout. (if "default" the selected branch will be used)
default: default
required: true
image-tag-latest:
description: Should be this docker labeled with tag latest? Enter `true` if the tag `latest` should be added for image.
default: "true"
required: true

jobs:
publish-docker-helm:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
IMAGE-NAME: "lighty-netconf-simulator"
PUBLISH_ACCESS_KEY: ${{ secrets.MM_PKG_WRITE }}
name: "Publish netconf-simulator docker image. Checkout-ref: ${{ github.event.inputs.checkout-ref }}"
steps:
- name: Tag image
shell: bash
run: |
image_name=$(mvn help:evaluate -f ${{ inputs.app-docker-pom-path }} -Dexpression=image.name -q -DforceStdout)
docker tag $image_name $DOCKER_IMAGE_NAME_TAG
if [ "${{ inputs.image-tag-latest }}" = 'true' ]; then
docker tag $image_name $DOCKER_IMAGE_NAME:latest
fi
docker images | grep $image_name
- name: List docker images
shell: bash
run: |
docker images
- name: Docker log in (ghcr.io)
shell: bash
run: |
echo ${{ inputs.publish-access-key}} | docker login --username ${{ github.actor }} --password-stdin ghcr.io
- name: Publish docker image (ghcr.io)
shell: bash
run: |
docker push $DOCKER_IMAGE_NAME_TAG
if [ "${{ inputs.image-tag-latest }}" = 'true' ]; then
docker push $DOCKER_IMAGE_NAME:latest
fi
- name: Check if docker image is pullable (ghcr.io)
shell: bash
run: |
docker rmi $DOCKER_IMAGE_NAME_TAG
docker pull $DOCKER_IMAGE_NAME_TAG
- name: Install yq (yaml processor)
shell: bash
run: |
sudo snap install yq
- name: Set image.name, image.version in values.yaml of helm chart
shell: bash
run: |
yq eval '.image.name="ghcr.io/pantheontech/${{ inputs.image-name }}" | .image.version="${{ inputs.version }}"' ${{ inputs.app-helm-values-path }} -i
- name: Print values.yaml
shell: bash
run: |
cat -A ${{ inputs.app-helm-values-path }}

0 comments on commit 2382d97

Please sign in to comment.