docker-reusable: add actions/checkout options

This commit is contained in:
Slava 2025-02-24 17:36:06 +02:00
parent 677c075955
commit 696e421199
No known key found for this signature in database
GPG Key ID: 351E7AA9BD0DFEB8
2 changed files with 33 additions and 12 deletions

View File

@ -34,6 +34,16 @@ on:
description: Suffix for Docker images tag description: Suffix for Docker images tag
required: false required: false
type: string type: string
checkout-fetch-depth:
default: ''
description: actions/checkout fetch-depth
required: false
type: string
checkout-fetch-tags:
default: ''
description: actions/checkout fetch-tags
required: false
type: string
amd64_builder: amd64_builder:
default: ubuntu-22.04 default: ubuntu-22.04
description: Builder for amd64 description: Builder for amd64
@ -53,6 +63,8 @@ env:
TAG_LATEST: ${{ inputs.tag_latest }} TAG_LATEST: ${{ inputs.tag_latest }}
TAG_SHA: ${{ inputs.tag_sha }} TAG_SHA: ${{ inputs.tag_sha }}
TAG_SUFFIX: ${{ inputs.tag_suffix }} TAG_SUFFIX: ${{ inputs.tag_suffix }}
CHECKOUT_FETCH_DEPTH: ${{ inputs.checkout-fetch-depth }}
CHECKOUT_FETCH_TAGS: ${{ inputs.checkout-fetch-tags }}
amd64_builder: ${{ inputs.amd64_builder }} amd64_builder: ${{ inputs.amd64_builder }}
arm64_builder: ${{ inputs.arm64_builder }} arm64_builder: ${{ inputs.arm64_builder }}
@ -87,6 +99,9 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: ${{ env.CHECKOUT_FETCH_DEPTH }}
fetch-tags: ${{ env.CHECKOUT_FETCH_TAGS }}
- name: Secrets to variables - name: Secrets to variables
if: ${{ env.BUILD_ARGS != '' }} if: ${{ env.BUILD_ARGS != '' }}

View File

@ -19,16 +19,18 @@
#### Inputs #### Inputs
| Variable | Description | | Variable | Description | Default |
| ---------------- | ---------------------------------- | | ---------------------- | ---------------------------------- | ------------------- |
| `docker_file` | Path to Dockerfile | | `docker_file` | Path to Dockerfile | `docker/Dockerfile` |
| `dockerhub_repo` | DockerHub repository | | `dockerhub_repo` | DockerHub repository | `codexstorage/test` |
| `build_args` | Build arguments | | `build_args` | Build arguments | `''` |
| `tag_latest` | Set latest tag for Docker images | | `tag_latest` | Set latest tag for Docker images | `true` |
| `tag_sha` | Set Git short commit as Docker tag | | `tag_sha` | Set Git short commit as Docker tag | `true` |
| `tag_suffix` | Suffix for Docker images tag | | `tag_suffix` | Suffix for Docker images tag | `''` |
| `amd64_builder` | Builder for amd64 | | `checkout-fetch-depth` | actions/checkout fetch-depth | `''` |
| `arm64_builder` | Builder for arm64 | | `checkout-fetch-tags` | actions/checkout fetch-tags | `''` |
| `amd64_builder` | Builder for amd64 | `ubuntu-22.04` |
| `arm64_builder` | Builder for arm64 | `ubuntu-22.04-arm` |
#### Secrets #### Secrets
@ -78,10 +80,14 @@ jobs:
with: with:
docker_file: docker/Dockerfile docker_file: docker/Dockerfile
dockerhub_repo: codexstorage/test dockerhub_repo: codexstorage/test
tag_latest: ${{ github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/') }}
amd64_builder: ubuntu-24.04
build_args: | build_args: |
VITE_CODEX_API_URL=${VITE_CODEX_API_URL} VITE_CODEX_API_URL=${VITE_CODEX_API_URL}
VITE_GEO_IP_URL="Plain text" VITE_GEO_IP_URL="Plain text"
tag_latest: ${{ github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/') }}
tag_suffix: 'custom'
checkout-fetch-depth: 0
checkout-fetch-tags: true
amd64_builder: ubuntu-24.04
arm64_builder: ubuntu-24.04-arm
secrets: inherit secrets: inherit
``` ```