Files
iot-cloud-api/.gitea/workflows/build_docker.yaml
Tobias Maier 691b09c954
Some checks failed
Build Project / test (push) Failing after 5m8s
First dev-ready build
2025-02-06 22:06:05 +00:00

62 lines
1.8 KiB
YAML

name: Build Project
on: [push]
jobs:
test:
runs-on: ubuntu-latest
container:
image: rust:latest
services:
db:
image: postgres:latest
env:
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
POSTGRES_DB: iot
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Install necessary dependencies
run: apt update && apt install nodejs pkg-config -y
- name: Install docker
run: curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
- name: Checkout Code
uses: actions/checkout@v2
- name: Run migrations
run: cargo install sqlx-cli && sqlx migrate run
- name: Build server binary
run: cargo build --release
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Registry
uses: docker/login-action@v1
with:
registry: gitea.maiertobi.de
username: tobimai
password: ${{ secrets.docker_registry_key }}
- name: Extract Version from Cargo.toml
id: cargo_version
run: |
VERSION=$(grep '^version' Cargo.toml | head -n 1 | cut -d ' ' -f 3 | tr -d '"')
echo "VERSION=$VERSION" >> $GITEA_ENV
- name: Extract Version from Cargo.toml
id: Extract version from cargo.toml
run: |
VERSION=$(grep '^version' Cargo.toml | head -n 1 | cut -d ' ' -f 3 | tr -d '"')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: gitea.maiertobi.de/tobimai/iot:${{ env.VERSION }}