docker-reusable: add actions/checkout options (#4)

This commit is contained in:
Slava 2025-02-24 17:41:58 +02:00 committed by GitHub
parent 677c075955
commit 6f77a131f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 12 deletions

View File

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

View File

@ -19,16 +19,18 @@
#### Inputs
| Variable | Description |
| ---------------- | ---------------------------------- |
| `docker_file` | Path to Dockerfile |
| `dockerhub_repo` | DockerHub repository |
| `build_args` | Build arguments |
| `tag_latest` | Set latest tag for Docker images |
| `tag_sha` | Set Git short commit as Docker tag |
| `tag_suffix` | Suffix for Docker images tag |
| `amd64_builder` | Builder for amd64 |
| `arm64_builder` | Builder for arm64 |
| Variable | Description | Default |
| ---------------------- | ---------------------------------- | ------------------- |
| `docker_file` | Path to Dockerfile | `docker/Dockerfile` |
| `dockerhub_repo` | DockerHub repository | `codexstorage/test` |
| `build_args` | Build arguments | `''` |
| `tag_latest` | Set latest tag for Docker images | `true` |
| `tag_sha` | Set Git short commit as Docker tag | `true` |
| `tag_suffix` | Suffix for Docker images tag | `''` |
| `checkout-fetch-depth` | actions/checkout fetch-depth | `''` |
| `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
@ -78,10 +80,14 @@ jobs:
with:
docker_file: docker/Dockerfile
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: |
VITE_CODEX_API_URL=${VITE_CODEX_API_URL}
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
```