Skip to content

Commit

Permalink
ci: update build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgouveia committed Dec 13, 2022
1 parent 30faa4d commit 0251b49
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 23 deletions.
10 changes: 9 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
node_modules
build
dist
.turbo
.vite
README.md
.github
.idea
.editorconfig
.gitignore
CONTRIBUTING.md
sonar-project.properties
17 changes: 0 additions & 17 deletions .github/workflows/ci.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pull Requests

on:
pull_request:
branches:
- main

jobs:
automated_review:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 7

- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Audit dependencies
run: pnpm audit

- name: Linting code
run: pnpm run --if-present lint

- name: Check code formatting
run: pnpm run --if-present format
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches: [ main ]

jobs:
drafter:
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package:
needs: drafter
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
flavor: ${{ inputs.docker-metadata-flavor }}
- id: extract-env
run: |
if [[ "$GITHUB_REF_TYPE" == tag ]]
then
echo "environment=production" >> $GITHUB_OUTPUT
else
echo "environment=qa" >> $GITHUB_OUTPUT
fi
- uses: docker/build-push-action@v3
with:
build-args: |
BUILD_MODE=${{ steps.extract-env.outputs.environment }}
context: .
file: Dockerfile.app
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 0 additions & 5 deletions Dockerfile

This file was deleted.

14 changes: 14 additions & 0 deletions Dockerfile.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG BUILD_MODE=production

FROM node:16 as build-web
WORKDIR /build
COPY . .
RUN npm install -g pnpm && \
pnpm install --frozen-lockfile && \
BUILD_MODE=${BUILD_MODE} pnpm build

FROM nginx:stable-alpine
COPY --from=build-web /build/apps/polyflix/dist /usr/share/nginx/html
COPY .docker/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8080
CMD [ "nginx", "-g", "daemon off;" ]

0 comments on commit 0251b49

Please sign in to comment.