This commit is contained in:
Shahrad Elahi
2024-05-29 20:10:18 +03:30
committed by GitHub
parent 66a1fe2ece
commit efb93e5e31
162 changed files with 2780 additions and 2758 deletions

View File

@@ -10,6 +10,12 @@ concurrency:
group: '${{ github.workflow }}-${{ github.event.number || github.sha }}'
cancel-in-progress: true
env:
BUILD_PLATFORMS: linux/amd64,linux/arm64
DOCKERHUB_SLUG: shahradel/wireadmin
GHCR_SLUG: ghcr.io/wireadmin/wireadmin
TAG: dev
jobs:
lint:
runs-on: ubuntu-latest
@@ -24,25 +30,37 @@ jobs:
cache: 'pnpm'
- run: pnpm -r install --frozen-lockfile
- run: pnpm --if-present format:check
- run: pnpm --if-present lint
- run: pnpm format:check
image:
if: github.repository == 'wireadmin/wireadmin'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PRIVATE_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
- name: Build & Publish
uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: ./Dockerfile
push: false
push: ${{ github.event_name != 'pull_request' }}
platforms: '${{ env.BUILD_PLATFORMS }}'
tags: '${{ env.GHCR_SLUG }}:${{ env.TAG }},${{ env.DOCKERHUB_SLUG }}:${{ env.TAG }}'

View File

@@ -1,75 +0,0 @@
name: Build Prerelease Image
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build'
required: true
##
# Invoke:
# gh workflow run "Build Prerelease Image" -f tag=2.0.0-canary.0
##
env:
IMAGE_TAG: ${{ github.event.inputs.tag }}
BUILD_PLATFORMS: linux/amd64,linux/arm64
permissions:
contents: read
packages: write
jobs:
ghcr-build:
runs-on: ubuntu-latest
env:
IMAGE_NAME: shahradelahi/wireadmin
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PRIVATE_TOKEN }}
- name: Push to GitHub Container Registry
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
args: VERSION=${{ env.IMAGE_TAG }}
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
docker-build:
runs-on: ubuntu-latest
env:
IMAGE_NAME: litehex/wireadmin
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to DockerHub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
platforms: ${{ env.BUILD_PLATFORMS }}
args: VERSION=${{ env.IMAGE_TAG }}
tags: docker.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

View File

@@ -1,87 +1,100 @@
name: Release Package
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build'
required: true
push:
branches:
- canary
concurrency: '${{ github.workflow }}-${{ github.ref }}'
env:
BUILD_PLATFORMS: linux/amd64,linux/arm64
IMAGE_TAG: ${{ github.event.inputs.tag }}
permissions:
contents: read
packages: write
DOCKERHUB_SLUG: shahradel/wireadmin
GHCR_SLUG: ghcr.io/wireadmin/wireadmin
jobs:
release:
needs: [github-registry, docker-hub]
if: github.repository == 'wireadmin/wireadmin'
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
fetch-depth: 0
version: 8
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
commit: 'chore(release): version package'
title: 'chore(release): version package'
publish: changeset publish
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.PRIVATE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github-registry:
name: Push to GitHub Container Registry
build:
name: Build & Publish
runs-on: ubuntu-latest
env:
IMAGE_NAME: shahradelahi/wireadmin
needs: release
if: needs.release.outputs.published == 'true'
strategy:
fail-fast: true
matrix:
package: ${{ fromJson(needs.release.outputs.publishedPackages) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PRIVATE_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Container Registry
uses: docker/build-push-action@v5
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
context: .
file: ./Dockerfile
images: |
${{ env.DOCKERHUB_SLUG }}
${{ env.GHCR_SLUG }}
tags: |
type=semver,pattern={{version}},value=${{ matrix.package.version }}
- name: Build and push
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-all
push: true
platforms: ${{ env.BUILD_PLATFORMS }}
args: VERSION=${{ env.IMAGE_TAG }}
tags: ghcr.io/${{ env.IMAGE_NAME }}:latest,ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
docker-hub:
name: Push to DockerHub
runs-on: ubuntu-latest
env:
IMAGE_NAME: litehex/wireadmin
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v3
- name: Check manifest
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to DockerHub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
platforms: ${{ env.BUILD_PLATFORMS }}
args: VERSION=${{ env.IMAGE_TAG }}
tags: docker.io/${{ env.IMAGE_NAME }}:latest,docker.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Inspect image
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker pull ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}