Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/actions-go/go-action


https://github.com/actions-go/go-action

automation cd ci github github-actions github-actions-golang golang golang-examples workflow

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        


typescript-action status

# Create an Action using Golang

Use this template to bootstrap the creation of a Golang action.:rocket:

This template includes compiliation support, tests, a validation workflow, publishing, and versioning guidance.

## Create an action from this template

Click the `Use this Template` and provide the new repo details for your action

## Code in Master

Install the dependencies
```bash
$ go mod download
```

Build the code
```bash
$ go build
```

Run the tests :heavy_check_mark:
```bash
$ go test -v ./...

=== RUN TestRunMain
--- PASS: TestRunMain (0.01s)
PASS
ok github.com/actions-go/go-action 0.315s

...
```

Commit the pre-built binaries to `./dist/main_linux`, `./dist/main_darwin` and `./dist/main_windows.exe` for respectively linux, mac OS and windows actions.

## Change action.yml

The action.yml contains defines the inputs and output for your action.

Update the action.yml with your name, description, inputs and outputs for your action.

See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)

## Publish to a distribution branch

Actions are run from GitHub repos. We will create a releases branch and only checkin production modules (core in this case).

```bash
$ git checkout -b releases/v1
$ git commit -a -m "prod dependencies"
```

```bash
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
```

Your action is now published! :rocket:

See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)

## Usage:

After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and tested action

```yaml
uses: actions-go/go-action@master
with:
milliseconds: 1000
```