mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-30 17:10:42 +03:00
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
name: Build and Push Docker Image (latest)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- chore/all-my-stuffs
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: |
|
|
echo "Before: corepack version => $(corepack --version || echo 'not installed')"
|
|
npm install -g corepack@latest
|
|
echo "After : corepack version => $(corepack --version)"
|
|
corepack enable
|
|
pnpm --version
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
|
|
- name: Run linters
|
|
run: pnpm lint
|
|
|
|
- name: Run unit tests
|
|
run: pnpm test
|
|
|
|
- name: Build the app
|
|
run: pnpm build
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- ci
|
|
steps:
|
|
# Checkout the repository
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
sharevb/it-tools:latest
|
|
ghcr.io/${{ github.repository_owner }}/it-tools:latest
|
|
|
|
# Optionally log out
|
|
- name: Log out from GitHub Container Registry
|
|
run: docker logout ghcr.io |