From 49246956edfc8cb652f30f68fd5b12d3bca2a833 Mon Sep 17 00:00:00 2001 From: Alessandro Cifani Date: Wed, 8 May 2024 20:33:45 +0200 Subject: [PATCH] build: add docker and release --- .github/workflows/release.yaml | 39 ++++++++++++++++++++++++++++++++++ Dockerfile | 10 +++++++++ package.json | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..5d21b5c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,39 @@ +name: Build and deploy + +on: + push: + branches: [main] + +permissions: + packages: write + +env: + IMAGE_NAME: ghcr.io/acifani/actual-rest-api:${{ github.sha }} + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ env.IMAGE_NAME }} + + - uses: caprover/deploy-from-github@v1.1.2 + with: + server: '${{ secrets.CAPROVER_SERVER }}' + app: '${{ secrets.APP_NAME }}' + token: '${{ secrets.APP_TOKEN }}' + image: ${{ env.IMAGE_NAME }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7c0d184 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:20-slim +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" + +WORKDIR /usr/src/app +COPY . /usr/src/app + +RUN corepack enable && pnpm install + +CMD ["pnpm", "start"] diff --git a/package.json b/package.json index d8c2d45..65734ca 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "actual-to-csv", + "name": "actual-rest-api", "version": "1.0.0", "description": "", "main": "dist/index.js",