diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..4baac51 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Test + +on: + push: + branches: [ main ] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: ./ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..94a2e1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM alpine +RUN apk add --no-cache bash +COPY entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..65206ce --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 WaterLemons2k + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..604cbd5 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Bash Action - **Docker** + +A Bash Action template using **Docker** that outputs `Hello World` or `Hello` + name to the log by default. + +This template includes [test](.github/workflows/test.yml). + +## Usage + +Click the `Use this template` -> `Create a new repository` for your Action. + +## Update `action.yml` + +Update your Action's [`action.yml`](action.yml) with your `name`, `description`, `inputs` and `outputs`. + +## Compare + +Compare with other Bash Action templates: + +| Using | Advantage | Disadvantage | Recommend to | +| ----------- | -------------------------- | ----------------------------------- | ---------------------------------------------- | +| docker | Container can be used. | Need to build the image every time. | Bash that only can be run in container. | +| [node] | Node.js can be used. | Need to run Bash via Node.js. | Just run Bash. | +| [composite] | Other Actions can be used. | Need to mapped inputs via env. | Bash needs other Actions or doesn't want node. | + +[node]:https://github.com/actions-bash/node +[composite]:https://github.com/actions-bash/composite + +## See also + +- [Creating a Docker container action - GitHub Docs](https://docs.github.com/actions/creating-actions/creating-a-docker-container-action) \ No newline at end of file diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..6ad1527 --- /dev/null +++ b/action.yml @@ -0,0 +1,16 @@ +name: 'Bash Action - Docker container' +description: 'A Bash Action template using Docker.' + +inputs: + name: + description: 'Name of thing' + required: false + default: 'World' + +outputs: + time: + description: 'Current time' + +runs: + using: 'docker' + image: 'Dockerfile' \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..4a04015 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +echo "Hello $INPUT_NAME" +echo "time=$(date)" >> $GITHUB_OUTPUT \ No newline at end of file