ci: add builder
This commit is contained in:
parent
20d9256aa9
commit
bf3bc761a5
3 changed files with 44 additions and 0 deletions
42
.github/workflows/build.yml
vendored
Normal file
42
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
name: builder
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
|
paths:
|
||||||
|
- 'VERSION'
|
||||||
|
workflow_dispatch:
|
||||||
|
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
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@main
|
||||||
|
- name: login to ghcr
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{github.actor}}
|
||||||
|
password: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
- name: get version
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
input_file="VERSION"
|
||||||
|
while read line
|
||||||
|
do
|
||||||
|
file_text=$line
|
||||||
|
done < "$input_file"
|
||||||
|
echo ::set-output name=version::$file_text
|
||||||
|
- name: build images
|
||||||
|
run: |
|
||||||
|
docker build ./api --tag ghcr.io/greysoh/api:${{ steps.get_version.outputs.version }}
|
||||||
|
docker push ghcr.io/greysoh/api:${{ steps.get_version.outputs.version }}
|
1
VERSION
Normal file
1
VERSION
Normal file
|
@ -0,0 +1 @@
|
||||||
|
0.1.0
|
|
@ -1,4 +1,5 @@
|
||||||
FROM node:20.11.1-bookworm
|
FROM node:20.11.1-bookworm
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/greysoh/nextnet"
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
COPY src /app/src
|
COPY src /app/src
|
||||||
COPY prisma /app/prisma
|
COPY prisma /app/prisma
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue