setup pipeline for Github Actions

This commit is contained in:
biersoeckli
2024-12-18 16:49:38 +00:00
parent 7b352947d2
commit c0390f4b98
4 changed files with 115 additions and 47 deletions

60
.github/workflows/build-release.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Build and Push Docker Image
on:
workflow_dispatch:
release:
types: [released, prereleased]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies for backend
run: yarn install && yarn run prisma-generate
- name: Run tests for backend
run: yarn test
build-and-push:
runs-on: ubuntu-latest
needs: test
if: ${{ needs.test.result == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: ./
push: true
platforms: linux/amd64 #,linux/arm64
build-args: |
VERSION_ARG=${{ github.ref_name }}
tags: |
quickstack/quickstack:latest
# quickstack/quickstack:${{ github.ref_name }}

28
.github/workflows/tests.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Test on Beta Push
on:
workflow_dispatch:
pull_request:
branches:
- main
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies for backend
run: yarn install && yarn run prisma-generate
- name: Run tests for backend
run: yarn test