Compare commits
4 Commits
main
...
feature_do
Author | SHA1 | Date | |
---|---|---|---|
f2098c69d5 | |||
7168342f3e | |||
4c469f30d0 | |||
083bb2c535 |
@ -1,36 +0,0 @@
|
|||||||
name: test
|
|
||||||
run-name: test
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: ovlach/docker-gitea:v0.0.2-alpha
|
|
||||||
steps:
|
|
||||||
- uses: https://github.com/actions/checkout.git@v4
|
|
||||||
- uses: actions/docker-image@v1
|
|
||||||
name: Test action
|
|
||||||
id: docker_image_test
|
|
||||||
with:
|
|
||||||
deployment_login: ${{ secrets.DEPLOYMENT_PACKAGE }}
|
|
||||||
registry: 'git.nanobyte.cz'
|
|
||||||
image_name: git.nanobyte.cz/${{ github.repository_owner }}/action-test
|
|
||||||
docker_version_prefix: 'test'
|
|
||||||
docker_file: 'test/test.Dockerfile'
|
|
||||||
additional_version: ''
|
|
||||||
docker_push: false
|
|
||||||
- shell: sh
|
|
||||||
run: |
|
|
||||||
echo "${{ steps.docker_image_test.outputs.image_version }}"
|
|
||||||
echo "${{ steps.docker_image_test.outputs.image_ref }}"
|
|
||||||
|
|
||||||
if [ -z "${{ steps.docker_image_test.outputs.image_version }}" ]; then
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
if [ -z "${{ steps.docker_image_test.outputs.image_ref }}" ]; then
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
41
action.yml
41
action.yml
@ -10,33 +10,18 @@ inputs:
|
|||||||
image_name:
|
image_name:
|
||||||
description: 'Image name'
|
description: 'Image name'
|
||||||
required: true
|
required: true
|
||||||
docker_version_prefix:
|
aditional_args:
|
||||||
description: 'docker image version prefix'
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
additional_args:
|
|
||||||
description: 'Docker build arguments'
|
description: 'Docker build arguments'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
additional_version:
|
platform:
|
||||||
description: 'Additional version'
|
description: 'Platform'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: 'linux/amd64'
|
||||||
docker_file:
|
|
||||||
description: 'Dockerfile'
|
|
||||||
required: false
|
|
||||||
default: 'Dockerfile'
|
|
||||||
docker_push:
|
|
||||||
description: 'Push images'
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
outputs:
|
outputs:
|
||||||
image_version:
|
image_version:
|
||||||
description: "Image version"
|
description: "Image version"
|
||||||
value: ${{ steps.git.outputs.short_hash }}
|
value: ${{ steps.git.outputs.short_hash }}
|
||||||
image_ref:
|
|
||||||
description: "Image ref"
|
|
||||||
value: ${{ steps.image.outputs.version }}
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@ -51,23 +36,7 @@ runs:
|
|||||||
id: git
|
id: git
|
||||||
run: echo "::set-output name=short_hash::$(git rev-parse --short HEAD)"
|
run: echo "::set-output name=short_hash::$(git rev-parse --short HEAD)"
|
||||||
shell: sh
|
shell: sh
|
||||||
- name: Store image version
|
|
||||||
id: image
|
|
||||||
run: echo "version=${{ inputs.image_name }}:${{inputs.docker_version_prefix}}-${{ steps.git.outputs.short_hash }}" >> $GITHUB_OUTPUT && cat $GITHUB_OUTPUT
|
|
||||||
shell: sh
|
|
||||||
- name: Build additional args (version etc.)
|
|
||||||
id: additional_args
|
|
||||||
run: echo "::set-output name=additional_args::$(if [[ "${{inputs.additional_version}}" != "" ]]; then echo "-t ${{ inputs.image_name }}:${{inputs.docker_version_prefix}}-${{inputs.additional_version}}"; else echo ""; fi)"
|
|
||||||
shell: sh
|
|
||||||
- name: Build and push docker
|
- name: Build and push docker
|
||||||
run: |
|
run: |
|
||||||
docker build . -f ${{inputs.docker_file}} -t ${{ inputs.image_name }}:${{inputs.docker_version_prefix}}-${{ steps.git.outputs.short_hash }} ${{steps.additional_args.outputs.additional_args}} ${{ inputs.additional_args }}
|
docker buildx build --tag ${{ inputs.image_name }}:${{ steps.git.outputs.short_hash }} ${{ inputs.aditional_args }} --platform ${{inputs.platform }} --push .
|
||||||
|
|
||||||
if [[ "${{inputs.docker_push}}" == "true" ]]; then
|
|
||||||
docker push ${{ inputs.image_name }}:${{inputs.docker_version_prefix}}-${{ steps.git.outputs.short_hash }}
|
|
||||||
|
|
||||||
if [[ "${{inputs.additional_version}}" != "" ]]; then
|
|
||||||
docker push ${{ inputs.image_name }}:${{inputs.docker_version_prefix}}-${{inputs.additional_version}}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
shell: sh
|
shell: sh
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
FROM alpine:3.21.2
|
|
||||||
RUN echo "test"
|
|
Loading…
x
Reference in New Issue
Block a user