name: ci/cd to build and push docker image debian_runner in private registry #https://docs.docker.com/build/ci/github-actions/push-multi-registries/ #https://www.devsync.se/ci/cd/docker/2023/10/27/gitea-runner-build-docker-containers.html on: push: tags: # Be carefull, conflict with package-deb *.*.*, don't use more than on dot *.* (ex: 2.5-runner) - '*-chart' env: CHART_NAME: testchart jobs: build-and-push-internal: #! see on runner /data/.runner to add label (test => test:docker://debian:bullseye) runs-on: ubuntu-runner container: image: alpine/helm steps: - name: Show Information run: echo "Runner ${{ runner.os }} working on repository ${{ gitea.repository }} and on tag ${{ gitea.ref_name }}" - name: clone & package run: | helm create ${{ env.CHART_NAME }} helm package ${{ env.CHART_NAME }} curl --user ${{ REGISTRY_DOCKER_USER }}:${{ REGISTRY_DOCKER_PASS }} -X POST --upload-file ./${{ env.CHART_NAME }}-0.1.0.tgz https://gitea.example.com/api/packages/${{ REGISTRY_DOCKER_USER }}/helm/api/charts # helm repo add --username {username} --password {password} {repo} https://gitea.example.com/api/packages/{owner}/helm # helm cm-push ./{chart_file}.tgz {repo} # curl --user {username}:{password} -X POST --upload-file ./{chart_file}.tgz https://gitea.example.com/api/packages/{owner}/helm/api/charts # - name: Git clone private repository # uses: actions/checkout@v4 # with: # repository: ${{ gitea.repository }} # token: ${{ secrets.REPO_PULL_GITEA }} # - name: Login to docker private registry # uses: docker/login-action@v3 # with: # registry: ${{ vars.REGISTRY_DOCKER }} # username: ${{ secrets.REGISTRY_DOCKER_USER }} # password: ${{ secrets.REGISTRY_DOCKER_PASS }} # - run: git --help # - name: Build and push image in registry # uses: docker/build-push-action@v5 # with: # context: . # push: true # tags: ${{ vars.REGISTRY_DOCKER }}/${{ env.CHART_NAME }}:latest,${{ vars.REGISTRY_DOCKER }}/${{ env.CHART_NAME }}:${{ gitea.ref_name }} # - name: Output # run: echo "Runner push on ${{ vars.REGISTRY_DOCKER }} image ${{ env.CHART_NAME }} tag ${{ gitea.ref_name }}"