workflows
This commit is contained in:
commit
f6fc420b53
10
.gitea/workflows/build.yaml
Normal file
10
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name: 'Test Go Action'
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
use-go-action:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.20
|
14
action.yml
Normal file
14
action.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
name: 'Simple Go Action'
|
||||||
|
description: 'A simple Gitea action written in go'
|
||||||
|
inputs:
|
||||||
|
username:
|
||||||
|
description: 'The username to print'
|
||||||
|
required: true
|
||||||
|
outputs:
|
||||||
|
time:
|
||||||
|
description: 'The time when the action was called'
|
||||||
|
runs:
|
||||||
|
using: 'go'
|
||||||
|
main: 'main.go'
|
||||||
|
pre: "pre/pre.go"
|
||||||
|
post: "post/post.go"
|
7
go.mod
Normal file
7
go.mod
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module simple-go-action
|
||||||
|
|
||||||
|
go 1.20
|
||||||
|
|
||||||
|
require github.com/sethvargo/go-githubactions v1.1.0
|
||||||
|
|
||||||
|
require github.com/sethvargo/go-envconfig v0.8.0 // indirect
|
5
go.sum
Normal file
5
go.sum
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||||
|
github.com/sethvargo/go-envconfig v0.8.0 h1:AcmdAewSFAc7pQ1Ghz+vhZkilUtxX559QlDuLLiSkdI=
|
||||||
|
github.com/sethvargo/go-envconfig v0.8.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
|
||||||
|
github.com/sethvargo/go-githubactions v1.1.0 h1:mg03w+b+/s5SMS298/2G6tHv8P0w0VhUFaqL1THIqzY=
|
||||||
|
github.com/sethvargo/go-githubactions v1.1.0/go.mod h1:qIboSF7yq2Qnaw2WXDsqCReM0Lo1gU4QXUWmhBC3pxE=
|
15
main.go
Normal file
15
main.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
gha "github.com/sethvargo/go-githubactions"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
username := gha.GetInput("username")
|
||||||
|
fmt.Printf("username is %s\n", username)
|
||||||
|
|
||||||
|
gha.SetOutput("time", time.Now().Format("2006-01-02 15:04:05"))
|
||||||
|
}
|
7
post/post.go
Normal file
7
post/post.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("Post of Simple Go Action")
|
||||||
|
}
|
7
pre/pre.go
Normal file
7
pre/pre.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("Pre of Simple Go Action")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user