🎉 first commit
This commit is contained in:
75
.github/actions/docker-buildx-push/action.yaml
vendored
Normal file
75
.github/actions/docker-buildx-push/action.yaml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: "Docker buildx and push"
|
||||
description: "Buildx and push the Docker image."
|
||||
|
||||
inputs:
|
||||
ghcr-token:
|
||||
description: Token of current GitHub account in GitHub container registry.
|
||||
required: false
|
||||
default: ""
|
||||
dockerhub-user:
|
||||
description: "User name for the DockerHub account"
|
||||
required: false
|
||||
default: ""
|
||||
dockerhub-token:
|
||||
description: Token for the DockerHub account
|
||||
required: false
|
||||
default: ""
|
||||
push:
|
||||
description: Should push the docker image or not.
|
||||
required: false
|
||||
default: "false"
|
||||
platforms:
|
||||
description: Target platforms for building image
|
||||
required: false
|
||||
default: "linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x"
|
||||
image-name:
|
||||
description: The basic name of docker.
|
||||
required: false
|
||||
default: "upage"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Docker meta for UPage
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/${{ github.repository_owner }}/${{ inputs.image-name }}
|
||||
halohub/${{ inputs.image-name }}
|
||||
tags: |
|
||||
type=schedule,pattern=nightly-{{date 'YYYYMMDD'}},enabled=${{ github.event_name == 'schedule' }}
|
||||
type=ref,event=branch,enabled=${{ github.event_name == 'push' }}
|
||||
type=ref,event=pr,enabled=${{ github.event_name == 'pull_request' }}
|
||||
type=semver,pattern={{major}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{ version }}
|
||||
type=sha,enabled=${{ github.event_name == 'push' }}
|
||||
flavor: |
|
||||
latest=false
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v3
|
||||
if: inputs.ghcr-token != '' && github.event_name != 'pull_request'
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ inputs.ghcr-token }}
|
||||
- name: Login to DockerHub
|
||||
if: inputs.dockerhub-token != '' && github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ inputs.dockerhub-user }}
|
||||
password: ${{ inputs.dockerhub-token }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: ${{ inputs.platforms }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
push: ${{ (inputs.ghcr-token != '' || inputs.dockerhub-token != '') && inputs.push == 'true' }}
|
||||
32
.github/actions/setup-and-build/action.yaml
vendored
Normal file
32
.github/actions/setup-and-build/action.yaml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Setup and Build
|
||||
description: Generic setup action
|
||||
inputs:
|
||||
pnpm-version:
|
||||
required: false
|
||||
type: string
|
||||
default: '9.4.0'
|
||||
node-version:
|
||||
required: false
|
||||
type: string
|
||||
default: '20.15.1'
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: ${{ inputs.pnpm-version }}
|
||||
run_install: false
|
||||
|
||||
- name: Set Node.js version to ${{ inputs.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node-version }}
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies and build project
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm run build
|
||||
27
.github/workflows/ci.yaml
vendored
Normal file
27
.github/workflows/ci.yaml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup and Build
|
||||
uses: ./.github/actions/setup-and-build
|
||||
|
||||
- name: Run type check
|
||||
run: pnpm run typecheck
|
||||
|
||||
- name: Run check
|
||||
run: pnpm run check
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run test
|
||||
39
.github/workflows/docker.yaml
vendored
Normal file
39
.github/workflows/docker.yaml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Docker Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "**"
|
||||
- "!**.md"
|
||||
- '!docs/**'
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
concurrency:
|
||||
group: ${{github.workflow}} - ${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
docker-build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup and Build
|
||||
uses: ./.github/actions/setup-and-build
|
||||
- name: Docker Buildx and Push
|
||||
uses: ./.github/actions/docker-buildx-push
|
||||
with:
|
||||
image-name: ${{ github.event_name == 'release' && 'upage' || 'upage-dev' }}
|
||||
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
dockerhub-user: ${{ secrets.DOCKER_USERNAME }}
|
||||
dockerhub-token: ${{ secrets.DOCKER_TOKEN }}
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x
|
||||
35
.github/workflows/docs.yaml
vendored
Normal file
35
.github/workflows/docs.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Docs CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**' # This will only trigger the workflow when files in docs directory change
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
build_docs:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./docs
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Configure Git Credentials
|
||||
run: |
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: mkdocs-material-${{ env.cache_id }}
|
||||
path: .cache
|
||||
restore-keys: |
|
||||
mkdocs-material-
|
||||
|
||||
- run: pip install mkdocs-material
|
||||
- run: mkdocs gh-deploy --force
|
||||
Reference in New Issue
Block a user