Add .gitea/workflows/*.yaml
This commit is contained in:
@@ -3,9 +3,19 @@ name: Example CI
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
image-name:
|
||||||
|
description: "Name for image"
|
||||||
|
default: "gitea.cuihang1201.synology.me/hangpersonal/ci-test"
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
image-tag:
|
image-tag:
|
||||||
description: "Tag for image"
|
description: "Tag for image"
|
||||||
default: "latest" # Define Docker image tag
|
default: "latest"
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
container-name:
|
||||||
|
description: "Name for container"
|
||||||
|
default: "ci-test"
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
@@ -56,7 +66,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v5 # Build Docker image via Dockerfile
|
uses: docker/build-push-action@v5 # Build Docker image via Dockerfile
|
||||||
with:
|
with:
|
||||||
context: backend # Directory of Dockerfile
|
context: backend # Directory of Dockerfile
|
||||||
tags: ${{ vars.IMAGE }}:${{ inputs.image-tag }}
|
tags: ${{ inputs.image-name }}:${{ inputs.image-tag }}
|
||||||
outputs: type=docker,dest=/tmp/image.tar
|
outputs: type=docker,dest=/tmp/image.tar
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
@@ -78,9 +88,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker load --input /tmp/image.tar
|
docker load --input /tmp/image.tar
|
||||||
docker image ls -a
|
docker image ls -a
|
||||||
docker run --rm -p 8143:80 -d ${{ vars.IMAGE }}:${{ inputs.image-tag }}
|
docker run --rm -p 8143:80 --name ${{ inputs.container-name }} -d ${{ inputs.image-name }}:${{ inputs.image-tag }}
|
||||||
sleep 5
|
sleep 5
|
||||||
curl --fail 'http://localhost:8143/'
|
curl --fail 'http://${{ vars.LOCALHOST }}:8143/'
|
||||||
|
|
||||||
publish-image:
|
publish-image:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|||||||
Reference in New Issue
Block a user