|
|
|
@@ -15,12 +15,12 @@ permissions:
|
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
|
REGISTRY: git.farh.net
|
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
|
IMAGE_NAME: cartsnitch/receiptwitness
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
lint:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
- name: Set up Python
|
|
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
|
|
run: ruff check src/ tests/
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
- name: Set up Python
|
|
|
|
@@ -46,7 +46,7 @@ jobs:
|
|
|
|
|
run: pytest tests/ -v
|
|
|
|
|
|
|
|
|
|
build-and-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
|
needs: [lint, test]
|
|
|
|
|
outputs:
|
|
|
|
@@ -69,12 +69,12 @@ jobs:
|
|
|
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
|
echo "CalVer tag: $VERSION"
|
|
|
|
|
|
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
|
|
|
- name: Log in to GHCR
|
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
|
with:
|
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Extract metadata
|
|
|
|
|
id: meta
|
|
|
|
@@ -102,7 +102,7 @@ jobs:
|
|
|
|
|
git push origin "v${{ steps.calver.outputs.version }}"
|
|
|
|
|
|
|
|
|
|
grype:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
needs: [build-and-push]
|
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
|
steps:
|
|
|
|
@@ -126,15 +126,24 @@ jobs:
|
|
|
|
|
ignore-file: .grype.yaml
|
|
|
|
|
|
|
|
|
|
deploy-dev:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
needs: [grype]
|
|
|
|
|
if: always() && !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/dev'
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
- name: Checkout infra repo
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
repository: cartsnitch/infra
|
|
|
|
|
token: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
|
|
|
ref: main
|
|
|
|
|
path: infra
|
|
|
|
|
|
|
|
|
@@ -147,7 +156,7 @@ jobs:
|
|
|
|
|
- name: Update receiptwitness image tag
|
|
|
|
|
run: |
|
|
|
|
|
cd infra/apps/overlays/dev
|
|
|
|
|
kustomize edit set image git.farh.net/cartsnitch/receiptwitness:sha-${{ github.sha }}
|
|
|
|
|
kustomize edit set image ghcr.io/cartsnitch/receiptwitness:sha-${{ github.sha }}
|
|
|
|
|
|
|
|
|
|
- name: Commit and push to infra
|
|
|
|
|
run: |
|
|
|
|
@@ -160,15 +169,24 @@ jobs:
|
|
|
|
|
git push origin main
|
|
|
|
|
|
|
|
|
|
deploy-uat:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: runners-cartsnitch
|
|
|
|
|
needs: [grype]
|
|
|
|
|
if: always() && !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/uat'
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
- name: Checkout infra repo
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
repository: cartsnitch/infra
|
|
|
|
|
token: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
|
|
|
ref: main
|
|
|
|
|
path: infra
|
|
|
|
|
|
|
|
|
@@ -181,7 +199,7 @@ jobs:
|
|
|
|
|
- name: Update receiptwitness image tag
|
|
|
|
|
run: |
|
|
|
|
|
cd infra/apps/overlays/uat
|
|
|
|
|
kustomize edit set image git.farh.net/cartsnitch/receiptwitness:${{ needs.build-and-push.outputs.calver_tag }}
|
|
|
|
|
kustomize edit set image ghcr.io/cartsnitch/receiptwitness:${{ needs.build-and-push.outputs.calver_tag }}
|
|
|
|
|
|
|
|
|
|
- name: Commit and push to infra
|
|
|
|
|
run: |
|