chore: update workflow files to gitea #2
+12
-12
@@ -1,41 +1,41 @@
|
||||
name: Build and Push
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
env:
|
||||
IMAGE: ghcr.io/rmcampos/shell-whats
|
||||
IMAGE: docker.io/rmcampos/shell-whats
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: easynode-debian
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v4.2.0
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4.1.0
|
||||
run: docker buildx inspect --bootstrap
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v7.2.0
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.IMAGE }}:latest
|
||||
${{ env.IMAGE }}:${{ github.sha }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
cache-from: type=registry,ref=rmcampos/shell-whats:buildcache
|
||||
cache-to: type=registry,ref=rmcampos/shell-whats:buildcache,mode=max
|
||||
|
||||
@@ -8,8 +8,7 @@ on:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
IMAGE: ghcr.io/rmcampos/shell-whats
|
||||
GHCR_USERNAME: "RMCampos"
|
||||
IMAGE: docker.io/rmcampos/shell-whats
|
||||
K8S_NAMESPACE: "shell-whats"
|
||||
KUBECONFIG_CONTEXT: "default"
|
||||
KUBECONFIG_PATH: "~/.kube/config"
|
||||
@@ -25,15 +24,15 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Terraform
|
||||
uses: hashicorp/setup-terraform@v4.0.1
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
|
||||
- name: Setup kubectl
|
||||
uses: azure/setup-kubectl@v5.1.0
|
||||
uses: azure/setup-kubectl@v4
|
||||
|
||||
- name: Setup Doppler CLI
|
||||
uses: dopplerhq/cli-action@v4
|
||||
@@ -92,7 +91,6 @@ jobs:
|
||||
TF_VAR_kubeconfig_path: ${{ env.KUBECONFIG_PATH }}
|
||||
TF_VAR_kubeconfig_context: ${{ env.KUBECONFIG_CONTEXT }}
|
||||
TF_VAR_namespace: ${{ env.K8S_NAMESPACE }}
|
||||
TF_VAR_ghcr_username: ${{ env.GHCR_USERNAME }}
|
||||
run: |
|
||||
doppler run --config prd_secrets -- bash -c '
|
||||
export TF_VAR_whatsapp_token="$WHATSAPP_TOKEN"
|
||||
@@ -100,7 +98,6 @@ jobs:
|
||||
export TF_VAR_chatwoot_api_key="$CHATWOOT_API_KEY"
|
||||
export TF_VAR_verify_token="$VERIFY_TOKEN"
|
||||
export TF_VAR_meta_proxy_url="$META_PROXY_URL"
|
||||
export TF_VAR_ghcr_token="$GITHUB_PAT"
|
||||
export TF_VAR_wa_phone_number_id="$WA_PHONE_NUMBER_ID"
|
||||
export TF_VAR_chatwoot_url="$CHATWOOT_URL"
|
||||
export TF_VAR_chatwoot_inbox_id="$CHATWOOT_INBOX_ID"
|
||||
@@ -119,13 +116,13 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Upload plan artifact
|
||||
uses: actions/upload-artifact@v7.0.1
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: tfplan
|
||||
path: terraform/tfplan
|
||||
|
||||
terraform-apply:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: easynode-debian
|
||||
needs: plan
|
||||
if: >
|
||||
(github.event_name == 'push' || github.event_name == 'workflow_run')
|
||||
@@ -136,13 +133,13 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v4.0.1
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
|
||||
- name: Download plan artifact
|
||||
uses: actions/download-artifact@v8.0.1
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: tfplan
|
||||
path: terraform
|
||||
|
||||
+1
-28
@@ -29,30 +29,6 @@ locals {
|
||||
labels = { app = local.app_name }
|
||||
}
|
||||
|
||||
# ── GHCR image pull secret ────────────────────────────────────────────────────
|
||||
|
||||
resource "kubernetes_secret" "ghcr" {
|
||||
metadata {
|
||||
name = "ghcr-secret"
|
||||
namespace = var.namespace
|
||||
}
|
||||
|
||||
type = "kubernetes.io/dockerconfigjson"
|
||||
|
||||
data = {
|
||||
".dockerconfigjson" = jsonencode({
|
||||
auths = {
|
||||
"ghcr.io" = {
|
||||
username = var.ghcr_username
|
||||
password = var.ghcr_token
|
||||
email = var.ghcr_email
|
||||
auth = base64encode("${var.ghcr_username}:${var.ghcr_token}")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
# ── Secret ────────────────────────────────────────────────────────────────────
|
||||
|
||||
resource "kubernetes_secret" "app" {
|
||||
@@ -109,10 +85,7 @@ resource "kubernetes_deployment" "app" {
|
||||
labels = local.labels
|
||||
}
|
||||
|
||||
spec {
|
||||
image_pull_secrets {
|
||||
name = "ghcr-secret"
|
||||
}
|
||||
spec {
|
||||
container {
|
||||
name = local.app_name
|
||||
image = var.image
|
||||
|
||||
@@ -88,21 +88,3 @@ variable "meta_proxy_url" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
# ── GHCR image pull secret ────────────────────────────────────────────────────
|
||||
|
||||
variable "ghcr_username" {
|
||||
description = "GitHub username for pulling images from ghcr.io"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "ghcr_token" {
|
||||
description = "GitHub personal access token (read:packages scope) for ghcr.io"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "ghcr_email" {
|
||||
description = "Email associated with the GitHub account"
|
||||
type = string
|
||||
default = "ricardompcampos@gmail.com"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user