forked from PANTHEONtech/lighty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Tobianas/Tobianas-patch-1
Add Publish netconf-simulator
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
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
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
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 }} |