Compare commits
10 Commits
94dbbc7743
...
v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe4ad86710 | ||
|
|
cd35b8e85e | ||
|
|
3af0af01e0 | ||
|
|
456fde28a5 | ||
|
|
159eb7fbc3 | ||
|
|
d5047e2f89 | ||
|
|
67646c80d2 | ||
|
|
ee139f9518 | ||
|
|
8f200514b1 | ||
|
|
b90038ea4c |
@@ -6,8 +6,7 @@ on:
|
||||
- main
|
||||
|
||||
env:
|
||||
REGISTRY: git.sebse.de
|
||||
IMAGE: git.sebse.de/sebse/factorio-signal-exporter
|
||||
CHART_PATH: web/charts/factorio-signal-exporter
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -17,47 +16,49 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v4
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
- name: Bump version
|
||||
id: version
|
||||
uses: https://git.sebse.de/sebse/actions/version-bump@main
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.GITEA_USERNAME }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
token: ${{ github.token }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.IMAGE }}
|
||||
tags: |
|
||||
type=sha,prefix=,format=short
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./web
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ env.IMAGE }}:latest
|
||||
cache-to: type=inline
|
||||
|
||||
- name: Package Helm chart
|
||||
- name: Set env vars
|
||||
run: |
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
helm package web/charts/factorio-signal-exporter \
|
||||
--version "0.0.0-${SHORT_SHA}" \
|
||||
--app-version "${SHORT_SHA}"
|
||||
echo "IMAGE=git.sebse.de/${{ github.repository }}" >> $GITHUB_ENV
|
||||
echo "IMAGE_MIGRATE=git.sebse.de/${{ github.repository }}-migrate" >> $GITHUB_ENV
|
||||
|
||||
- name: Push Helm chart to Gitea
|
||||
run: |
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
curl -u ${{ secrets.GITEA_USERNAME }}:${{ secrets.GITEA_TOKEN }} \
|
||||
-X POST \
|
||||
https://${{ env.REGISTRY }}/api/packages/sebse/helm/api/charts \
|
||||
-F "chart=@factorio-signal-exporter-0.0.0-${SHORT_SHA}.tgz" \
|
||||
--fail-with-body
|
||||
- name: Docker login
|
||||
uses: https://git.sebse.de/sebse/actions/docker-login@main
|
||||
with:
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push app
|
||||
uses: https://git.sebse.de/sebse/actions/docker-build-push@main
|
||||
with:
|
||||
image: ${{ env.IMAGE }}
|
||||
build-context: ./web
|
||||
|
||||
- name: Build and push migrate
|
||||
uses: https://git.sebse.de/sebse/actions/docker-build-push@main
|
||||
with:
|
||||
image: ${{ env.IMAGE_MIGRATE }}
|
||||
build-context: ./web
|
||||
dockerfile: ./web/Dockerfile.migrate
|
||||
|
||||
- name: Package and push helm chart
|
||||
uses: https://git.sebse.de/sebse/actions/helm-package-push@main
|
||||
with:
|
||||
chart-path: ${{ env.CHART_PATH }}
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
app-version: ${{ steps.version.outputs.version }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Deploy to prod
|
||||
uses: https://git.sebse.de/sebse/actions/helm-deploy@main
|
||||
with:
|
||||
app: factorio-signal-exporter
|
||||
profile: prod
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
ssh-key: ${{ secrets.HELMBOT_SSH_KEY }}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
10
web/Dockerfile.migrate
Normal file
10
web/Dockerfile.migrate
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM node:24-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci
|
||||
|
||||
COPY migrations/ ./migrations/
|
||||
|
||||
CMD ["npm", "run", "migrate"]
|
||||
@@ -9,10 +9,12 @@ spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "factorio-signal-exporter.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: app
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "factorio-signal-exporter.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: app
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
@@ -21,9 +23,8 @@ spec:
|
||||
{{- end }}
|
||||
initContainers:
|
||||
- name: migrate
|
||||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["npm", "run", "migrate"]
|
||||
image: {{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}
|
||||
imagePullPolicy: {{ .Values.initImage.pullPolicy }}
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -8,6 +8,7 @@ spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
{{- include "factorio-signal-exporter.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: app
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: 3000
|
||||
@@ -1,7 +1,12 @@
|
||||
image:
|
||||
repository: git.sebse.de/sebse/factorio-signal-exporter
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
pullPolicy: Always
|
||||
|
||||
initImage:
|
||||
repository: git.sebse.de/sebse/factorio-signal-exporter-migrate
|
||||
tag: latest
|
||||
pullPolicy: Always
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user