59 lines
2.4 KiB
Markdown
59 lines
2.4 KiB
Markdown
|
|
---
|
||
|
|
gitea: none
|
||
|
|
include_toc: true
|
||
|
|
---
|
||
|
|
|
||
|
|
# Docker Push Action
|
||
|
|
|
||
|
|
A composite action to tag and push Docker images based on git context.
|
||
|
|
|
||
|
|
## Tag Logic
|
||
|
|
|
||
|
|
| Event | Condition | Tags Pushed |
|
||
|
|
|----------------|------------------|--------------------------------------------|
|
||
|
|
| `push` | Tag `v*.*.*` | `latest`, `<version>` (without `v` prefix) |
|
||
|
|
| `push` | Branch `main` | `latest` |
|
||
|
|
| `push` | Branch `develop` | `develop` |
|
||
|
|
| `pull_request` | Any | `pr<number>` |
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
```yaml
|
||
|
|
- name: Load Docker image
|
||
|
|
run: docker load < my-image.tar.gz
|
||
|
|
|
||
|
|
- name: Push Docker tags
|
||
|
|
uses: https://labs.phundrak.com/phundrak/docker-push-action@v1
|
||
|
|
with:
|
||
|
|
registry: labs.phundrak.com
|
||
|
|
registry-username: ${{ secrets.DOCKER_USERNAME }}
|
||
|
|
registry-password: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
|
image-name: phundrak/my-app
|
||
|
|
local-image: my-app:latest
|
||
|
|
event-name: ${{ github.event_name }}
|
||
|
|
ref: ${{ github.ref }}
|
||
|
|
ref-type: ${{ github.ref_type }}
|
||
|
|
ref-name: ${{ github.ref_name }}
|
||
|
|
pr-number: ${{ github.event.pull_request.number }}
|
||
|
|
```
|
||
|
|
|
||
|
|
## Inputs
|
||
|
|
|
||
|
|
| Input | Required | Description |
|
||
|
|
|---------------------|----------|------------------------------------------------|
|
||
|
|
| `registry` | Yes | Docker registry URL |
|
||
|
|
| `registry-username` | Yes | Docker registry username |
|
||
|
|
| `registry-password` | Yes | Docker registry password |
|
||
|
|
| `image-name` | Yes | Full image name (e.g., `phundrak/my-app`) |
|
||
|
|
| `local-image` | Yes | Local image to tag and push |
|
||
|
|
| `event-name` | Yes | Pass `${{ github.event_name }}` |
|
||
|
|
| `ref` | Yes | Pass `${{ github.ref }}` |
|
||
|
|
| `ref-type` | Yes | Pass `${{ github.ref_type }}` |
|
||
|
|
| `ref-name` | Yes | Pass `${{ github.ref_name }}` |
|
||
|
|
| `pr-number` | No | Pass `${{ github.event.pull_request.number }}` |
|
||
|
|
|
||
|
|
## Outputs
|
||
|
|
|
||
|
|
| Output | Description |
|
||
|
|
|---------------|-----------------------------------------------|
|
||
|
|
| `pushed-tags` | Space-separated list of tags that were pushed |
|