Skip to content

update_helm_repo

update_helm_repo #21

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: update_helm_repo
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
pull_request:
types:
- closed
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }}
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }}
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }}
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }}
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }}
IMAGE_TAG: ${{ github.sha }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Get or create an OCIR Repository
uses: oracle-actions/[email protected]
id: get-ocir-repository
with:
name: terraform_canvas
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
- name: Log into OCIR
uses: oracle-actions/[email protected]
id: login-ocir
with:
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
- name: Tag and push a container image
id: tag-and-push-image
run: |
docker build -t "terraform_canvas:new-frontend" .
docker tag "terraform_canvas:new-frontend" "${{ steps.get-ocir-repository.outputs.repo_path }}:$IMAGE_TAG"
docker push "${{ steps.get-ocir-repository.outputs.repo_path }}:$IMAGE_TAG"
- name: update front.yaml
run: |
cat <<EOF> front.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "terraform-canvas.fullname" . }}-front
labels:
app: {{ include "terraform-canvas.name" . }}-front
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "terraform-canvas.name" . }}-front
template:
metadata:
labels:
app: {{ include "terraform-canvas.name" . }}-front
spec:
serviceAccountName: {{ include "terraform-canvas.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}-front
image: ${{ steps.get-ocir-repository.outputs.repo_path }}:$IMAGE_TAG
ports:
- name: http
containerPort: {{ .Values.frontend.lb.http.targetPort}}
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: "front-service"
labels:
{{- include "terraform-canvas.labels" . | nindent 4 }}-front
spec:
type: {{ .Values.frontend.service.type }}
ports:
- name: http
port: {{ .Values.frontend.service.http.servicePort }}
targetPort: {{ .Values.frontend.service.http.targetPort }}
protocol: TCP
selector:
app: {{ include "terraform-canvas.name" . }}-front
EOF
- name: Pushes front image values file
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
with:
source_file: 'front.yaml'
destination_repo: 'Terraform-Canvas/canvas-helm'
destination_folder: 'charts/terraform-canvas/templates'
user_email: '[email protected]'
user_name: 'Eeap'
commit_message: "build: add img ${{ steps.get-ocir-repository.outputs.repo_path }}:$IMAGE_TAG"