Merge pull request #686 from PastVu/dependabot/npm_and_yarn/multi-2d3… #1825
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'en' | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build-and-push-app: | |
# This only makes sense to run for pastvu owned repo. | |
if: github.repository_owner == 'pastvu' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
- name: version | |
run: | | |
npm version --no-git-tag-version $(node -p "require('./package.json').version")-${GITHUB_SHA::8} | |
- name: Install dependencies | |
run: npm ci | |
- name: Test | |
run: npm run test | |
- name: Build | |
run: npm run build | |
#- name: Sentry | |
# env: | |
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
# run: | | |
# npm run sentry:sourcemaps | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build backend | |
- name: Backend metadata | |
id: docker_meta_backend | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/pastvu/backend/ru | |
- name: Build and push backend | |
id: docker_build_backend | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./.docker/backend.Dockerfile | |
tags: ${{ steps.docker_meta_backend.outputs.tags }} | |
labels: ${{ steps.docker_meta_backend.outputs.labels }} | |
push: true | |
# Build frontend | |
- name: Frontend Metadata | |
id: docker_meta_frontend | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/pastvu/frontend/ru | |
- name: Build and push frontend | |
id: docker_build_frontend | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./.docker/frontend.Dockerfile | |
tags: ${{ steps.docker_meta_frontend.outputs.tags }} | |
labels: ${{ steps.docker_meta_frontend.outputs.labels }} | |
push: true | |
- name: Image digest | |
run: | | |
echo ${{ steps.docker_build_backend.outputs.digest }} | |
echo ${{ steps.docker_build_frontend.outputs.digest }} |