This commit is contained in:
parent
9189325b9e
commit
262ae56e40
35
.gitea/workflows/test.yaml
Normal file
35
.gitea/workflows/test.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
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@main
|
||||
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
|
14
action.yml
14
action.yml
@ -26,6 +26,10 @@ inputs:
|
||||
description: 'Dockerfile'
|
||||
required: false
|
||||
default: 'Dockerfile'
|
||||
docker_push:
|
||||
description: 'Push images'
|
||||
required: false
|
||||
default: true
|
||||
outputs:
|
||||
image_version:
|
||||
description: "Image version"
|
||||
@ -49,7 +53,7 @@ runs:
|
||||
shell: sh
|
||||
- name: Store image version
|
||||
id: image
|
||||
run: echo "::set-output name=version::'${{ inputs.image_name }}:${{inputs.docker_version_prefix}}-${{ steps.git.outputs.short_hash }}'"
|
||||
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
|
||||
@ -59,9 +63,11 @@ runs:
|
||||
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 push ${{ inputs.image_name }}:${{inputs.docker_version_prefix}}-${{ steps.git.outputs.short_hash }}
|
||||
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
|
||||
git push ${{ inputs.image_name }}:${{inputs.additional_version}}-${{inputs.docker_version_prefix}}
|
||||
if [[ "${{inputs.additional_version}}" != "" ]]; then
|
||||
docker push ${{ inputs.image_name }}:${{inputs.additional_version}}-${{inputs.docker_version_prefix}}
|
||||
fi
|
||||
fi
|
||||
shell: sh
|
||||
|
2
test/test.Dockerfile
Normal file
2
test/test.Dockerfile
Normal file
@ -0,0 +1,2 @@
|
||||
FROM alpine:3.21.2
|
||||
RUN echo "test"
|
Loading…
x
Reference in New Issue
Block a user