initial commit

This commit is contained in:
Ondrej Vlach 2023-12-09 19:56:40 +01:00
commit 74b6c94c43
Signed by: ovlach
GPG Key ID: 4FF1A23B4914DE70

69
action.yml Normal file
View File

@ -0,0 +1,69 @@
name: 'Publish docker image in argocd' # TODO: rewrite to go
description: 'Publish docker image in argocd'
inputs:
argocd_app_repo:
description: "Argocd app repo (in format: repo/kubernetes/staging/kustomize.yaml)"
required: true
argocd_clone_ssh_key:
description: "Clone secret"
required: true
image:
description: "Image path"
required: true
image_version:
description: "Image version"
required: true
image_name:
description: "Image name (for example: web)"
required: true
environment:
description: "Environment (for example: staging)"
required: true
argocd_gitea_server:
description: "Gitea server"
default: "ssh://git.nanobyte.cz"
required: true
git_ref:
description: "Branch"
default: "master"
required: true
ssh_known_hosts:
description: "Aditional SSH known_hosts"
default: "git.nanobyte.cz ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3senpFPTYk75y73d1xL4XEDBe5AcLJ+GLEA+XTMpMiLsociwUeJZCJZoRUsZBH1bSvlgT23wlHtGJvDARygCBX/rZKKIb0KdD5qYgbtCzdmyg1Aw6+RNbgsOZuuDqh1HCLftj6PZWKXfEyp1rLjVCJEBmK2+iC54VjGTrm/0D3Mi1Tzpbmz0U+SqiZpNmC4GJu3riyxcXBrySsEZjWFcrUGSfVW9/MzzNk6relemGrkvBFDh6+lcx5bvPi3wamm0dlS+ySB9GhkGMukjCHHGLleRRZB3hf8ClbiMrod0KXwG1RQzqBIn3or4AUrl2ExIeA+olBTGIooy1sf/s8qBSGytYwUR1wbkMa9SIPWxIyioQY2uPu8Jg2qUYyZCJLNMeCVne5QGfxcDPm468pkkKOHVDqsVmhzRvcLuadpLHffZRg9Ds8LWSpIZh/OSWUkeavP0kSEN+vC4j/pFepYId3GJrEv/FN8KvdxKndkH2WyK2JAMcbTQAq3LiUgApuSuY1717VYNEhkEJ7u4NNmZhkW7WpTU75TCwMqrR77/eHO3ou5U7LEAKE4ujXrRX6HDgiRpg4psnI48hoJ/K50DYCL9CUAYcXLXjWhfmYUaN/1FYWS6cNpaTcwqOsdpYW4yfzqzIPLxe4GbIcEPinkywr7InwivyDIsPUYbXE9KBEw=="
required: true
commiter_email:
description: "Commiter email"
default: "gitea-bot@nanobyte.cz"
required: true
commiter_name:
description: "Commiter name"
default: "Gitea Bot"
required: true
outputs:
image_version:
description: "Image version"
value: ${{ steps.git.outputs.short_hash }}
runs:
using: "composite"
steps:
- uses: https://github.com/actions/checkout.git@v4
with:
ssh-key: ${{ inputs.argocd_clone_ssh_key }}
path: 'deployment'
repository: ${{ inputs.argocd_app_repo}}
ref: ${{ inputs.ref }}
github-server-url: ${{ inputs.argocd_gitea_server }}
ssh-known-hosts: '${{ inputs.ssh_known_hosts }}'
- name: configure git
run: git config --global user.email ${{ inputs.commiter_email }} && git config --global user.name ${{ inputs.commiter_name }}
shell: sh
- name: Install kustomize
run: |
curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.3.0/kustomize_v5.3.0_linux_amd64.tar.gz -o kustomize.tar.gz && tar -xzf kustomize.tar.gz
shell: sh
- name: Update images
run: |
cd deployment && cd kubernetes/${{ inputs.environment }}/ && \
../../../kustomize edit set image ${{ inputs.image_name }}=${{ inputs.image }}:${{ inputs.image_version }} && \
git add . && git commit -m "upgrade ${{ inputs.image_name }} -> ${{ inputs.image_version }}" && git push origin
shell: sh