2024-01-08 09:52:33 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-04-26 20:31:28 +00:00
|
|
|
branches:
|
|
|
|
- canary
|
2024-01-08 09:52:33 +00:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
concurrency:
|
2024-04-26 20:31:28 +00:00
|
|
|
group: '${{ github.workflow }}-${{ github.event.number || github.sha }}'
|
2024-01-08 09:52:33 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2024-05-29 16:40:18 +00:00
|
|
|
env:
|
|
|
|
BUILD_PLATFORMS: linux/amd64,linux/arm64
|
|
|
|
DOCKERHUB_SLUG: shahradel/wireadmin
|
|
|
|
GHCR_SLUG: ghcr.io/wireadmin/wireadmin
|
|
|
|
TAG: dev
|
|
|
|
|
2024-01-08 09:52:33 +00:00
|
|
|
jobs:
|
2024-04-26 20:31:28 +00:00
|
|
|
lint:
|
2024-01-08 09:52:33 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v2
|
|
|
|
with:
|
2024-09-08 19:55:07 +00:00
|
|
|
version: 9
|
2024-01-08 09:52:33 +00:00
|
|
|
- uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: 20
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
2024-04-26 20:31:28 +00:00
|
|
|
- run: pnpm -r install --frozen-lockfile
|
2024-05-29 16:40:18 +00:00
|
|
|
- run: pnpm format:check
|
2024-01-08 09:52:33 +00:00
|
|
|
|
2024-04-26 20:31:28 +00:00
|
|
|
image:
|
2024-05-29 16:40:18 +00:00
|
|
|
if: github.repository == 'wireadmin/wireadmin'
|
2024-01-08 09:52:33 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-05-29 16:40:18 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-01-08 09:52:33 +00:00
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
|
2024-05-29 16:40:18 +00:00
|
|
|
- name: Login to DockerHub
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
2024-01-08 09:52:33 +00:00
|
|
|
- name: Login to GitHub Container Registry
|
2024-05-29 16:40:18 +00:00
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v3
|
2024-01-08 09:52:33 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
2024-05-29 16:40:18 +00:00
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2024-01-08 09:52:33 +00:00
|
|
|
|
2024-05-29 16:40:18 +00:00
|
|
|
- name: Build & Publish
|
2024-01-08 09:52:33 +00:00
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
2024-05-29 16:40:18 +00:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2024-01-08 09:52:33 +00:00
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
2024-05-29 16:40:18 +00:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
platforms: '${{ env.BUILD_PLATFORMS }}'
|
|
|
|
tags: '${{ env.GHCR_SLUG }}:${{ env.TAG }},${{ env.DOCKERHUB_SLUG }}:${{ env.TAG }}'
|