Merge pull request #795 from informatyzacja/dependabot/npm_and_yarn/e… #2589
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: CI | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main', 'auto-dependency-upgrade'] | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Setup yarn | |
run: corepack prepare [email protected] --activate | |
- name: Install deps | |
uses: ./.github/actions/yarn-install | |
- name: Setup GitHub Actions cache for Turbo | |
uses: dtinth/setup-github-actions-caching-for-turbo@v1 | |
with: | |
cache-prefix: parliamentary_ | |
- name: Format check | |
run: yarn format:check | |
- name: Lint | |
run: yarn lint | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: [api, web] | |
permissions: | |
contents: read | |
packages: write | |
env: | |
IMAGE_NAME: ${{ github.repository }}/${{ matrix.app }} | |
DOCKERFILE_PATH: ./apps/${{ matrix.app }}/Dockerfile | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ${{ env.DOCKERFILE_PATH }} | |
push: true | |
build-args: | | |
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }} | |
NEXT_PUBLIC_OAUTH_DOMAIN=${{ vars.NEXT_PUBLIC_OAUTH_DOMAIN }} | |
NEXT_PUBLIC_USOS_BASE_URL=${{ vars.NEXT_PUBLIC_USOS_BASE_URL }} | |
NEXT_PUBLIC_USOS_SCOPES=${{ vars.NEXT_PUBLIC_USOS_SCOPES }} | |
NEXT_PUBLIC_USOS_FIELDS=${{ vars.NEXT_PUBLIC_USOS_FIELDS }} | |
NEXTAUTH_URL=${{ vars.NEXTAUTH_URL }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache | |
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max |