2021-09-27 07:18:58 +02:00
# drone-github-action-plugin
2021-09-27 07:37:18 +02:00
This plugin allows running github actions as a drone plugin.
2021-09-27 07:18:58 +02:00
## Build
Build the binaries with the following commands:
```console
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
go build -v -a -tags netgo -o release/linux/amd64/plugin ./cmd
```
## Docker
Build the Docker images with the following commands:
```console
docker build \
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
--file docker/Dockerfile.linux.amd64 --tag plugins/github-actions .
```
## Plugin step usage
2021-10-07 14:10:34 +02:00
Provide uses, with & env of github action to use in plugin step settings. Provide GITHUB_TOKEN as environment variable if it is required for an action.
2021-09-27 07:18:58 +02:00
```console
steps:
- name: github-action
image: plugins/github-actions
settings:
uses: actions/hello-world-javascript-action@v1.1
with:
who-to-greet: Mona the Octocat
env:
hello: world
```
## Running locally
2023-03-11 10:58:02 +01:00
1. If you are running it on mac locally & /var/run/docker.sock file does not exist, first run this command `ln -s ~/.docker/run/docker.sock /var/run/docker.sock`
2. Running actions/hello-world-javascript-action action locally via docker:
2021-09-27 07:18:58 +02:00
```console
docker run --rm \
--privileged \
2021-10-07 11:57:36 +02:00
-v $(pwd):/drone \
-w /drone \
2021-09-27 07:18:58 +02:00
-e PLUGIN_USES="actions/hello-world-javascript-action@v1.1" \
-e PLUGIN_WITH="{\"who-to-greet\":\"Mona the Octocat\"}" \
-e PLUGIN_VERBOSE=true \
plugins/github-actions
2021-09-27 07:34:30 +02:00
```