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:
|
||||
description: 'Image name'
|
||||
required: true
|
||||
docker_version_prefix:
|
||||
description: 'docker image version prefix'
|
||||
required: false
|
||||
default: ''
|
||||
additional_args:
|
||||
aditional_args:
|
||||
description: 'Docker build arguments'
|
||||
required: false
|
||||
default: ''
|
||||
additional_version:
|
||||
description: 'Additional version'
|
||||
platform:
|
||||
description: 'Platform'
|
||||
required: false
|
||||
default: ''
|
||||
docker_file:
|
||||
description: 'Dockerfile'
|
||||
required: false
|
||||
default: 'Dockerfile'
|
||||
docker_push:
|
||||
description: 'Push images'
|
||||
required: false
|
||||
default: true
|
||||
default: 'linux/amd64'
|
||||
outputs:
|
||||
image_version:
|
||||
description: "Image version"
|
||||
value: ${{ steps.git.outputs.short_hash }}
|
||||
image_ref:
|
||||
description: "Image ref"
|
||||
value: ${{ steps.image.outputs.version }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
@ -51,23 +36,7 @@ runs:
|
||||
id: git
|
||||
run: echo "::set-output name=short_hash::$(git rev-parse --short HEAD)"
|
||||
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
|
||||
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 }}
|
||||
|
||||
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
|
||||
docker buildx build --tag ${{ inputs.image_name }}:${{ steps.git.outputs.short_hash }} ${{ inputs.aditional_args }} --platform ${{inputs.platform }} --push .
|
||||
shell: sh
|
||||
|
@ -1,2 +0,0 @@
|
||||
FROM alpine:3.21.2
|
||||
RUN echo "test"
|
Loading…
x
Reference in New Issue
Block a user