Skip to content

Commit 0251b49

Browse files
committed
ci: update build workflow
1 parent 30faa4d commit 0251b49

File tree

6 files changed

+104
-23
lines changed

6 files changed

+104
-23
lines changed

.dockerignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
node_modules
2-
build
2+
dist
3+
.turbo
4+
.vite
35
README.md
6+
.github
7+
.idea
8+
.editorconfig
9+
.gitignore
10+
CONTRIBUTING.md
11+
sonar-project.properties

.github/workflows/ci.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/pull_request.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Pull Requests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
automated_review:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- uses: pnpm/action-setup@v2
15+
with:
16+
version: 7
17+
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 16.x
21+
cache: 'pnpm'
22+
23+
- name: Install dependencies
24+
run: pnpm install
25+
26+
- name: Audit dependencies
27+
run: pnpm audit
28+
29+
- name: Linting code
30+
run: pnpm run --if-present lint
31+
32+
- name: Check code formatting
33+
run: pnpm run --if-present format

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
drafter:
9+
permissions:
10+
contents: write
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: release-drafter/release-drafter@v5
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
17+
package:
18+
needs: drafter
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
- id: meta
28+
uses: docker/metadata-action@v4
29+
with:
30+
images: ghcr.io/${{ github.repository }}
31+
flavor: ${{ inputs.docker-metadata-flavor }}
32+
- id: extract-env
33+
run: |
34+
if [[ "$GITHUB_REF_TYPE" == tag ]]
35+
then
36+
echo "environment=production" >> $GITHUB_OUTPUT
37+
else
38+
echo "environment=qa" >> $GITHUB_OUTPUT
39+
fi
40+
- uses: docker/build-push-action@v3
41+
with:
42+
build-args: |
43+
BUILD_MODE=${{ steps.extract-env.outputs.environment }}
44+
context: .
45+
file: Dockerfile.app
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

Dockerfile.app

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ARG BUILD_MODE=production
2+
3+
FROM node:16 as build-web
4+
WORKDIR /build
5+
COPY . .
6+
RUN npm install -g pnpm && \
7+
pnpm install --frozen-lockfile && \
8+
BUILD_MODE=${BUILD_MODE} pnpm build
9+
10+
FROM nginx:stable-alpine
11+
COPY --from=build-web /build/apps/polyflix/dist /usr/share/nginx/html
12+
COPY .docker/nginx.conf /etc/nginx/conf.d/default.conf
13+
EXPOSE 8080
14+
CMD [ "nginx", "-g", "daemon off;" ]

0 commit comments

Comments
 (0)