Clean base - v0.0.1 setup
This commit is contained in:
parent
c0865327a6
commit
cab41db529
7 changed files with 117 additions and 28 deletions
0
.github/workflows/.trigger-test
vendored
Normal file
0
.github/workflows/.trigger-test
vendored
Normal file
50
.github/workflows/build-and-deploy.yaml
vendored
50
.github/workflows/build-and-deploy.yaml
vendored
|
|
@ -1,54 +1,48 @@
|
||||||
name: Build and Deploy to Kubernetes
|
name: Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
- 'feat/**'
|
||||||
|
- 'test/**'
|
||||||
|
- 'fix/**'
|
||||||
|
- 'hotfix/**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
VERSION: ${{ vars.VERSION || 'latest' }}
|
||||||
|
NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'prod' || 'web' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
env:
|
|
||||||
KUBECONFIG: ${HOME}/.kube/config
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Debug repository name
|
|
||||||
run: |
|
|
||||||
echo "Repository: ${{ github.repository }}"
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and Push Docker Image
|
- name: Build and push Docker image
|
||||||
run: |
|
run: |
|
||||||
IMAGE_NAME="ghcr.io/${{ github.repository }}"
|
IMAGE_NAME="ghcr.io/${{ github.repository }}:$VERSION"
|
||||||
docker build -t "$IMAGE_NAME:latest" .
|
docker build -t $IMAGE_NAME .
|
||||||
docker push "$IMAGE_NAME:latest"
|
docker push $IMAGE_NAME
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Set up Kubeconfig
|
- name: Set up kubeconfig from secret
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${HOME}/.kube
|
mkdir -p $HOME/.kube
|
||||||
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > ${HOME}/.kube/config
|
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > $HOME/.kube/config
|
||||||
chmod 600 ${HOME}/.kube/config
|
|
||||||
export KUBECONFIG=${HOME}/.kube/config
|
|
||||||
kubectl version --client
|
|
||||||
kubectl cluster-info
|
|
||||||
cat ${HOME}/.kube/config
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Deploy to Kubernetes
|
- name: Deploy to Kubernetes
|
||||||
run: |
|
run: |
|
||||||
export KUBECONFIG=${HOME}/.kube/config
|
IMAGE="ghcr.io/${{ github.repository }}:$VERSION"
|
||||||
IMAGE_NAME="ghcr.io/${{ github.repository }}"
|
kubectl set image deployment/homepage home=$IMAGE -n $NAMESPACE
|
||||||
kubectl set image deployment/homepage home=$IMAGE_NAME:v0.0.1 -n web
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
53
.github/workflows/deploy.yaml
vendored
Normal file
53
.github/workflows/deploy.yaml
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# .github/workflows/deploy.yaml
|
||||||
|
|
||||||
|
name: Build and Deploy to Kubernetes
|
||||||
|
|
||||||
|
#on:
|
||||||
|
# push:
|
||||||
|
# branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Debug Variables
|
||||||
|
run: echo "Repository: ${{ github.repository }}"
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
run: |
|
||||||
|
IMAGE_NAME="ghcr.io/${{ github.repository }}"
|
||||||
|
docker build -t "$IMAGE_NAME:latest" .
|
||||||
|
docker push "$IMAGE_NAME:latest"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Set up Kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > ~/.kube/config
|
||||||
|
chmod 600 ~/.kube/config
|
||||||
|
|
||||||
|
- name: Deploy to Kubernetes
|
||||||
|
run: |
|
||||||
|
kubectl set image deployment/homepage homepage=ghcr.io/${{ github.repository }}:latest -n web
|
||||||
|
|
||||||
|
- name: Set up kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > ~/.kube/config
|
||||||
|
chmod 600 ~/.kube/config
|
||||||
|
env:
|
||||||
|
KUBECONFIG: ~/.kube/config
|
||||||
40
.github/workflows/docker.yml
vendored
Normal file
40
.github/workflows/docker.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
run: |
|
||||||
|
IMAGE="ghcr.io/${{ github.repository }}"
|
||||||
|
docker build -t "$IMAGE:latest" .
|
||||||
|
docker push "$IMAGE:latest"
|
||||||
|
|
||||||
|
- name: Set up Kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > ~/.kube/config
|
||||||
|
chmod 600 ~/.kube/config
|
||||||
|
env:
|
||||||
|
KUBECONFIG: ~/.kube/config
|
||||||
|
|
||||||
|
- name: Deploy to Kubernetes
|
||||||
|
run: |
|
||||||
|
IMAGE="ghcr.io/${{ github.repository }}"
|
||||||
|
kubectl set image deployment/homepage homepage=$IMAGE:latest -n web
|
||||||
1
.trigger-test
Normal file
1
.trigger-test
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# trigger test Fri Apr 11 14:35:35 UTC 2025
|
||||||
0
trigger-workflow.txt
Normal file
0
trigger-workflow.txt
Normal file
1
version.txt
Normal file
1
version.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
v0.0.4
|
||||||
Loading…
Reference in a new issue