diff --git a/README.md b/README.md index 2faad78..36e6e67 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,3 @@ # Composite actions for Halo -1. Docker build for Halo - - ```yaml - uses: halo-sigs/actions/halo-next-docker-build@main # prefer to specific ref. - with: - ghcr_token: ${{ secrets.GHCR_TOKEN }} # default is "" - dockerhub-user: halohub - dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - push: true # default is false - image-name: halodev # default is halo - console-ref: main # The Git ref of console project. Default is main. - ``` - -1. Docker build for Halo admin - - ```yaml - uses: halo-sigs/actions/admin-next-docker-build-push@main # prefer to specific ref. - with: - ghcr_token: ${{ secrets.GHCR_TOKEN }} # default is "" - dockerhub-user: halohub - dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - push: true # default is false - image-name: halodev # default is halo - checkout-from: next # default is default branch - ``` +TBD. diff --git a/admin-env-setup/action.yaml b/admin-env-setup/action.yaml deleted file mode 100644 index 1ddaa8d..0000000 --- a/admin-env-setup/action.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: "Admin Environment Setup" -description: "Admin environment setup, including Node.js setup, pnpm setup and pnpm cache setup" - -inputs: - node-version: - description: Node.js version. - required: false - default: "18" - pnpm-version: - description: pnpm version. - required: false - default: "8" - -runs: - using: "composite" - steps: - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.node-version }} - - - uses: pnpm/action-setup@v2 - name: Setuop pnpm - id: pnpm-install - with: - version: ${{ inputs.pnpm-version }} - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH}} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- diff --git a/admin-next-docker-build-push/action.yaml b/admin-next-docker-build-push/action.yaml deleted file mode 100644 index 2d6780a..0000000 --- a/admin-next-docker-build-push/action.yaml +++ /dev/null @@ -1,88 +0,0 @@ -name: "Docker build" -description: "Builds 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" - image-name: - description: The basic name of docker. - required: false - default: "admin" - -runs: - using: "composite" - steps: - - name: Environment Set Up - uses: halo-sigs/actions/admin-env-setup@main - - name: Build Package - shell: bash - run: | - pnpm install - pnpm build:packages - pnpm build - - name: DockerHub image - id: dockerhub-image - shell: bash - run: | - if [ -z ${{ inputs.dockerhub-user }} ] - then - echo "docker_image=" >> $GITHUB_OUTPUT - else - echo "docker_image=halohub/${{ inputs.image-name }}" >> $GITHUB_OUTPUT - fi - - name: Docker meta for Halo admin - id: meta - uses: docker/metadata-action@v3 - with: - images: | - ghcr.io/${{ github.repository_owner }}/${{ inputs.image-name }} - ${{ steps.dockerhub-image.outputs.docker_image }} - 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={{ version }} - type=semver,pattern={{major}}.{{minor}} - type=sha,enabled=${{ github.event_name == 'push' }} - flavor: | - latest=false - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to GHCR - uses: docker/login-action@v2 - 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@v2 - with: - username: ${{ inputs.dockerhub-user }} - password: ${{ inputs.dockerhub-token }} - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64 - labels: ${{ steps.meta.outputs.labels }} - tags: ${{ steps.meta.outputs.tags }} - push: ${{ (inputs.ghcr-token != '' || inputs.dockerhub-token != '') && inputs.push == 'true' }} diff --git a/halo-next-docker-build/action.yaml b/halo-next-docker-build/action.yaml deleted file mode 100644 index bdc2012..0000000 --- a/halo-next-docker-build/action.yaml +++ /dev/null @@ -1,118 +0,0 @@ -name: "Docker build" -description: "Builds 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" - load: - description: Should load the image into docker 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: "halo" - console-ref: - description: The Git ref of console project. - required: false - default: "main" - -runs: - using: "composite" - steps: - - name: Setup JDK - uses: actions/setup-java@v3 - with: - distribution: "temurin" - cache: "gradle" - java-version: 17 - - name: Setup console environment - uses: halo-sigs/actions/admin-env-setup@main - - name: Build Console - shell: bash - run: | - make -C console build - - name: Reset version of Halo - if: github.event_name == 'release' - shell: bash - run: | - # Set the version with tag name when releasing - version=${{ github.event.release.tag_name }} - version=${version#v} - sed -i "s/version=.*-SNAPSHOT$/version=$version/1" gradle.properties - - name: Build with Gradle - shell: bash - run: | - ./gradlew downloadPluginPresets - ./gradlew clean build -x check - - name: DockerHub image - id: dockerhub-image - run: | - if [ -z ${{ inputs.dockerhub-user }} ] - then - echo "docker_image=" >> $GITHUB_OUTPUT - else - echo "docker_image=halohub/${{ inputs.image-name }}" >> $GITHUB_OUTPUT - fi - shell: bash - - name: Docker meta for Halo - id: meta - uses: docker/metadata-action@v4 - with: - images: | - ghcr.io/${{ github.repository_owner }}/${{ inputs.image-name }} - ${{ steps.dockerhub-image.outputs.docker_image }} - 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={{ version }} - type=semver,pattern={{major}}.{{minor}} - type=sha,enabled=${{ github.event_name == 'push' }} - flavor: | - latest=false - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to GHCR - uses: docker/login-action@v2 - 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@v2 - with: - username: ${{ inputs.dockerhub-user }} - password: ${{ inputs.dockerhub-token }} - - name: Build and push - uses: docker/build-push-action@v4 - 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' }} - load: ${{ inputs.load == 'true' }}