From bf3bc761a570a4713a2c03ba134a23c5c3df3433 Mon Sep 17 00:00:00 2001 From: dess Date: Sat, 4 May 2024 19:09:10 -0400 Subject: [PATCH] ci: add builder --- .github/workflows/build.yml | 42 +++++++++++++++++++++++++++++++++++++ VERSION | 1 + api/Dockerfile | 1 + 3 files changed, 44 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 VERSION diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4b6083e --- /dev/null +++ b/.github/workflows/build.yml @@ -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 }} \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6c6aa7c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 \ No newline at end of file diff --git a/api/Dockerfile b/api/Dockerfile index 51f8d04..9fe5b69 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,4 +1,5 @@ FROM node:20.11.1-bookworm +LABEL org.opencontainers.image.source="https://github.com/greysoh/nextnet" WORKDIR /app/ COPY src /app/src COPY prisma /app/prisma