feature: Adds building workflows.

This commit is contained in:
Tera << 8 2024-12-24 09:52:06 -05:00
parent b0b11413fb
commit 7879c65e25
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
7 changed files with 33 additions and 241 deletions

View file

@ -1,16 +0,0 @@
modifies labeler:
- .github/labeler.yml
modifies ci:
- .github/workflows/*.yml
modifies docker:
- '**/Dockerfile'
- '**/docker-compose.yml'
- '**/prod-docker.env'
modifies api:
- api/**/*
modifies lom:
- lom/**/*
modifies gui:
- gui/**/*
modifies nix:
- '**/*.nix'

View file

@ -1,61 +0,0 @@
name: CI Testing (API)
on:
pull_request:
paths:
- "api/**"
push:
paths:
- "api/**"
defaults:
run:
working-directory: api
env:
DATABASE_URL: "postgresql://nextnet:nextnet@localhost:5432/nextnet?schema=nextnet"
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: nextnet
POSTGRES_USER: nextnet
POSTGRES_DB: nextnet
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code using Git
uses: actions/checkout@main
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm install --save-dev
- name: Install prisma
run: npx prisma migrate dev
- name: Build source
run: npm run build
- name: Run eslint
run: npx eslint src
- name: Run prettier to verify if we're formatted or not
uses: creyD/prettier_action@v4.3
with:
dry: true

View file

@ -1,13 +0,0 @@
name: Label Issues / Pull Requests
on: [pull_request_target]
jobs:
label:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

View file

@ -1,40 +0,0 @@
name: CI Testing (LOM)
on:
pull_request:
paths:
- "lom/**"
push:
paths:
- "lom/**"
defaults:
run:
working-directory: lom
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code using Git
uses: actions/checkout@main
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm install --save-dev
- name: Build source
run: npm run build
- name: Run eslint
run: npx eslint src
- name: Run prettier to verify if we're formatted or not
uses: creyD/prettier_action@v4.3
with:
dry: true

View file

@ -1,110 +0,0 @@
name: Release code
on:
pull_request:
types:
- closed
paths:
- VERSION
workflow_dispatch: null
push:
branches: dev
paths:
- VERSION
tags-ignore:
- '*'
jobs:
build:
if: >-
github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' || github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout code using Git
uses: actions/checkout@main
- name: Get version information
id: get_version
run: echo "version=v$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Make tag on Git
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
custom_tag: ${{ steps.get_version.outputs.version }}
tag_prefix: ''
- name: Get previous Git tag
id: get_prev_version
run: echo "version=$(git describe --abbrev=0 --tags "$(git describe --abbrev=0 --tags)~") >> $GITHUB_OUTPUT"
- name: Make sparse changelog (1/2)
uses: heinrichreimer/github-changelog-generator-action@v2.1.1
with:
token: '${{secrets.GITHUB_TOKEN}}'
issues: true
issuesWoLabels: true
pullRequests: true
prWoLabels: true
sinceTag: ${{steps.get_prev_version.outputs.version}}
addSections: >-
{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}
- name: Make sparse changelog (2/2)
run: |
mv CHANGELOG.md SPARSE_CHANGELOG.md
- name: Make full changelog
uses: heinrichreimer/github-changelog-generator-action@v2.1.1
with:
token: '${{secrets.GITHUB_TOKEN}}'
issues: true
issuesWoLabels: true
pullRequests: true
prWoLabels: true
addSections: >-
{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}
- name: Update changelog
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: >-
chore: Update changelog for tag ${{steps.get_version.outputs.version}}.
file_pattern: CHANGELOG.md
- name: Release on GitHub
uses: softprops/action-gh-release@v2
with:
body_path: SPARSE_CHANGELOG.md
files: |
LICENSE
docker-compose.yml
repository: imterah/nextnet
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.get_version.outputs.version }}
- name: Log in to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build all docker images
run: |
docker build ./api --tag ghcr.io/imterah/nextnet:$(cat VERSION)
docker build ./lom --tag ghcr.io/imterah/nextnet-lom:$(cat VERSION)
- name: Publish all docker images
run: |
docker tag ghcr.io/imterah/nextnet:$(cat VERSION) ghcr.io/imterah/nextnet:latest
docker push ghcr.io/imterah/nextnet:$(cat VERSION)
docker push ghcr.io/imterah/nextnet:latest
docker tag ghcr.io/imterah/nextnet-lom:$(cat VERSION) ghcr.io/imterah/nextnet-lom:latest
docker push ghcr.io/imterah/nextnet-lom:$(cat VERSION)
docker push ghcr.io/imterah/nextnet-lom:latest

View file

@ -0,0 +1,33 @@
name: Release code
on:
push:
tags:
- "**"
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout code using Git
uses: actions/checkout@main
- name: Log in to Forgejo container registry
uses: https://github.com/docker/login-action@v3
with:
registry: git.terah.dev
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build all docker images
run: |
docker build ./backend --tag git.terah.dev/imterah/hermes:$GITHUB_REF_NAME
- name: Upload all docker images
run: |
docker tag git.terah.dev/imterah/hermes:$GITHUB_REF_NAME git.terah.dev/imterah/hermes:latest
docker push git.terah.dev/imterah/hermes:$GITHUB_REF_NAME
docker push git.terah.dev/imterah/hermes:latest

View file

@ -1 +0,0 @@
1.1.2