From 745261248610fb87453dfcc47dcec4c72c3cfa56 Mon Sep 17 00:00:00 2001 From: Hang Cui Date: Wed, 22 Oct 2025 14:54:46 -0700 Subject: [PATCH] Add docker_action.yaml --- .gitea/actions/docker-action/Dockerfile | 5 ++++ .gitea/actions/docker-action/action.yaml | 15 +++++++++++ .gitea/actions/docker-action/entrypoint.sh | 15 +++++++++++ .gitea/workflows/014_docker_action.yaml | 25 +++++++++++++++++++ .gitea/workflows/cache-go.yml | 29 ---------------------- 5 files changed, 60 insertions(+), 29 deletions(-) create mode 100755 .gitea/actions/docker-action/Dockerfile create mode 100755 .gitea/actions/docker-action/action.yaml create mode 100755 .gitea/actions/docker-action/entrypoint.sh create mode 100644 .gitea/workflows/014_docker_action.yaml delete mode 100644 .gitea/workflows/cache-go.yml diff --git a/.gitea/actions/docker-action/Dockerfile b/.gitea/actions/docker-action/Dockerfile new file mode 100755 index 0000000..9e81fa1 --- /dev/null +++ b/.gitea/actions/docker-action/Dockerfile @@ -0,0 +1,5 @@ +FROM ubuntu:latest + +COPY entrypoint.sh entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.gitea/actions/docker-action/action.yaml b/.gitea/actions/docker-action/action.yaml new file mode 100755 index 0000000..535dcb9 --- /dev/null +++ b/.gitea/actions/docker-action/action.yaml @@ -0,0 +1,15 @@ +name: 'Simple param action' # Name of action +description: 'Prints the argument and stores it in the file' +inputs: + name: + description: 'First argument value' + required: true + default: 'Mike' +outputs: + processed-name: # processed-name is also defined in entrypoint.sh + description: 'Processed name' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.name }} \ No newline at end of file diff --git a/.gitea/actions/docker-action/entrypoint.sh b/.gitea/actions/docker-action/entrypoint.sh new file mode 100755 index 0000000..8f85f90 --- /dev/null +++ b/.gitea/actions/docker-action/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh -l + +# get the input parameter +echo "Arg received $1" + +# list the working directory +echo "Workdir:" +ls -la + +# get name and store it to name.txt +name=$1 +echo "$name" > name.txt + +# output processed-name to GITHUB_OUTPUT +echo "processed-name=$name" >> $GITHUB_OUTPUT diff --git a/.gitea/workflows/014_docker_action.yaml b/.gitea/workflows/014_docker_action.yaml new file mode 100644 index 0000000..9cd86ef --- /dev/null +++ b/.gitea/workflows/014_docker_action.yaml @@ -0,0 +1,25 @@ +# Run git update-index --chmod=+x entrypoint.sh to enable execution of action +name: Docker Action + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Run Custom Action + id: custom-action + uses: ./.gitea/actions/docker-action + with: # provide input parameter to above action + name: 'Hang' # name is one of the inputs defined inside the action’s action.yml + + - name: Print Processed Name + run: | + echo "Processed Name: ${{ steps.custom-action.outputs.processed-name }}" + echo "workdir" + ls -la \ No newline at end of file diff --git a/.gitea/workflows/cache-go.yml b/.gitea/workflows/cache-go.yml deleted file mode 100644 index e5e3ca4..0000000 --- a/.gitea/workflows/cache-go.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Caching with Go - -on: - workflow_dispatch: - -jobs: - Cache-Go: - name: Cache Go - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: '>=1.20.1' - - uses: https://gitea.com/actions/go-hashfiles@v0.0.1 - id: hash-go - with: - patterns: | - go.mod - go.sum - - name: cache go - id: cache-go - uses: actions/cache@v3 - with: # Specify with your cache path - path: | - /your_cache_path - key: go_path-${{ steps.hash-go.outputs.hash }} - restore-keys: | - go_cache-${{ steps.hash-go.outputs.hash }} \ No newline at end of file