Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WaterLemons2k committed Mar 25, 2023
0 parents commit 2c50abf
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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: ./
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine
RUN apk add --no-cache bash
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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'
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

echo "Hello $INPUT_NAME"
echo "time=$(date)" >> $GITHUB_OUTPUT

0 comments on commit 2c50abf

Please sign in to comment.