|
|
|
@@ -21,15 +21,8 @@ env:
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
build-and-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
|
services:
|
|
|
|
|
docker:
|
|
|
|
|
image: docker:dind
|
|
|
|
|
privileged: true
|
|
|
|
|
env:
|
|
|
|
|
DOCKER_HOST: tcp://docker:2375
|
|
|
|
|
DOCKER_TLS_CERTDIR: ""
|
|
|
|
|
outputs:
|
|
|
|
|
calver_tag: ${{ steps.calver.outputs.version }}
|
|
|
|
|
sha_tag: sha-${{ github.sha }}
|
|
|
|
@@ -50,7 +43,11 @@ jobs:
|
|
|
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
|
|
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
|
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
|
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
|
with:
|
|
|
|
|
registry: git.farh.net
|
|
|
|
|
username: cartsnitch
|
|
|
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Extract metadata
|
|
|
|
|
id: meta
|
|
|
|
@@ -69,6 +66,8 @@ jobs:
|
|
|
|
|
push: true
|
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
cache-from: type=gha
|
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
|
|
|
|
|
|
- name: Create git tag
|
|
|
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
@@ -77,14 +76,23 @@ jobs:
|
|
|
|
|
git push origin "v${{ steps.calver.outputs.version }}"
|
|
|
|
|
|
|
|
|
|
deploy-dev:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
needs: [build-and-push]
|
|
|
|
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main')
|
|
|
|
|
steps:
|
|
|
|
|
- name: Generate GitHub App token
|
|
|
|
|
id: app-token
|
|
|
|
|
uses: actions/create-github-app-token@v1
|
|
|
|
|
with:
|
|
|
|
|
app-id: ${{ secrets.CARTSNITCH_APP_ID }}
|
|
|
|
|
private-key: ${{ secrets.CARTSNITCH_APP_PRIVATE_KEY }}
|
|
|
|
|
owner: ${{ github.repository_owner }}
|
|
|
|
|
repositories: infra
|
|
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
repository: cartsnitch/infra
|
|
|
|
|
token: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
|
|
|
ref: main
|
|
|
|
|
path: infra
|
|
|
|
|
|
|
|
|
@@ -102,7 +110,7 @@ jobs:
|
|
|
|
|
- name: Update auth image tag in dev overlay
|
|
|
|
|
run: |
|
|
|
|
|
cd infra/apps/overlays/dev
|
|
|
|
|
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.tag.outputs.tag }}
|
|
|
|
|
kustomize edit set image ghcr.io/cartsnitch/auth:${{ steps.tag.outputs.tag }}
|
|
|
|
|
|
|
|
|
|
- name: Commit and push to infra
|
|
|
|
|
run: |
|
|
|
|
@@ -116,14 +124,23 @@ jobs:
|
|
|
|
|
git push origin main
|
|
|
|
|
|
|
|
|
|
deploy-uat:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
needs: [build-and-push]
|
|
|
|
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/uat' || github.ref == 'refs/heads/main')
|
|
|
|
|
steps:
|
|
|
|
|
- name: Generate GitHub App token
|
|
|
|
|
id: app-token
|
|
|
|
|
uses: actions/create-github-app-token@v1
|
|
|
|
|
with:
|
|
|
|
|
app-id: ${{ secrets.CARTSNITCH_APP_ID }}
|
|
|
|
|
private-key: ${{ secrets.CARTSNITCH_APP_PRIVATE_KEY }}
|
|
|
|
|
owner: ${{ github.repository_owner }}
|
|
|
|
|
repositories: infra
|
|
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
repository: cartsnitch/infra
|
|
|
|
|
token: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
|
|
|
ref: main
|
|
|
|
|
path: infra
|
|
|
|
|
|
|
|
|
@@ -141,7 +158,7 @@ jobs:
|
|
|
|
|
- name: Update auth image tag in uat overlay
|
|
|
|
|
run: |
|
|
|
|
|
cd infra/apps/overlays/uat
|
|
|
|
|
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.tag.outputs.tag }}
|
|
|
|
|
kustomize edit set image ghcr.io/cartsnitch/auth:${{ steps.tag.outputs.tag }}
|
|
|
|
|
|
|
|
|
|
- name: Commit and push to infra
|
|
|
|
|
run: |
|