Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
akerl committed Jan 21, 2023
0 parents commit eda1020
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on:
pull_request:
push:
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
env:
PKGFORGE_STATEFILE: /tmp/pkgforge
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
run: make
- name: Release
if: startsWith(github.ref, 'refs/tags/')
run: make release
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Post to a Slack channel
if: ${{ failure() }}
uses: slackapi/slack-github-action@v1.23.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"text": "*${{ github.repository }}*\nBuild failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.repository }}*\nBuild failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.gopath
/bin
/vendor/
/pkg/
/payload.zip
/.tools/
/Dockerfile
/smoosh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "meta"]
path = meta
url = https://github.com/akerl/pkgforge-golang-helper
28 changes: 28 additions & 0 deletions .pkgforge
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name 'prospectus-script'
org 'akerl'

source(
type: 'git',
path: '.'
)

build do
run 'make local'
cp 'bin'
end

package(
type: 'file',
artifacts: %w(darwin/amd64 darwin/arm64 linux/amd64 linux/arm linux/arm64).map do |x|
os, arch = x.split '/'
filename = "#{@forge.name}_#{os}_#{arch}"
{
source: "bin/#{filename}",
name: filename
}
end
)

test do
# TODO: add tests
end
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2023 Les Aker

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.

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include meta/Makefile
1 change: 1 addition & 0 deletions Makefile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PACKAGE = prospectus-static
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
prospectus-static
=========

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/akerl/prospectus-static/build.yml?branch=main)](https://github.com/akerl/prospectus-static/actions)
[![GitHub release](https://img.shields.io/github/release/akerl/prospectus-static.svg)](https://github.com/akerl/prospectus-static/releases)
[![License](https://img.shields.io/github/license/akerl/prospectus-static)](https://github.com/akerl/prospectus-static/blob/master/LICENSE)

## Usage

## Installation

```
go install github.com/akerl/prospectus-static@latest
```

## License

prospectus-static is released under the MIT License. See the bundled LICENSE file for details.
10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/akerl/prospectus-static

go 1.19

require github.com/akerl/prospectus/v3 v3.0.0

require (
github.com/ghodss/yaml v1.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
github.com/akerl/prospectus/v3 v3.0.0 h1:99fAifpUmx2Ci38kM7bFSVOpYnognIwIfsrIVrD+0+8=
github.com/akerl/prospectus/v3 v3.0.0/go.mod h1:9kryC2hxZtzi2SKI/UIBgXVOx0hladf2qDzkcW+xMe0=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
35 changes: 35 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"fmt"
"os"

"github.com/akerl/prospectus/v3/plugin"
)

type config struct {
Value string `json:"value"`
}

func run(cfg config) error {
if cfg.Value == "" {
return fmt.Errorf("required arg not provided: value")
}

fmt.Printf(cfg.Value)
return nil
}

func main() {
cfg := config{}
err := plugin.ParseConfig(&cfg)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to load config: %s", err)
os.Exit(1)
}
err = run(cfg)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
}
1 change: 1 addition & 0 deletions meta
Submodule meta added at 67efc7

0 comments on commit eda1020

Please sign in to comment.