Skip to content

Commit 0bc13a6

Browse files
workflow update (#108)
* workflow update * readme update * use os and io pkg to read/write file --------- Co-authored-by: Ramana Reddy <ramanaredy.manda@gmail.com>
1 parent 89378e4 commit 0bc13a6

File tree

11 files changed

+53
-26
lines changed

11 files changed

+53
-26
lines changed

.github/workflows/build-test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: 🔨 Build Test
2+
23
on:
3-
push:
44
pull_request:
5+
paths:
6+
- '**.go'
7+
- '**.mod'
58
workflow_dispatch:
69

710

@@ -13,7 +16,7 @@ jobs:
1316
- name: Set up Go
1417
uses: actions/setup-go@v4
1518
with:
16-
go-version: 1.18
19+
go-version: 1.19
1720

1821
- name: Check out code
1922
uses: actions/checkout@v3

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: 🚨 CodeQL Analysis
33
on:
44
workflow_dispatch:
55
pull_request:
6+
paths:
7+
- '**.go'
8+
- '**.mod'
69
branches:
710
- dev
811

.github/workflows/dockerhub-push.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: 🌥 Docker Push
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_run:
5+
workflows: ["🎉 Release Binary"]
6+
types:
7+
- completed
68
workflow_dispatch:
79

810
jobs:

.github/workflows/lint-test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: 🙏🏻 Lint Test
2+
23
on:
3-
push:
44
pull_request:
5+
paths:
6+
- '**.go'
7+
- '**.mod'
58
workflow_dispatch:
69

710
jobs:
@@ -12,7 +15,7 @@ jobs:
1215
- name: Set up Go
1316
uses: actions/setup-go@v4
1417
with:
15-
go-version: 1.18
18+
go-version: 1.19
1619
- name: Checkout code
1720
uses: actions/checkout@v3
1821
- name: Run golangci-lint

.github/workflows/release-binary.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 🎉 Release Binary
2+
23
on:
3-
create:
4+
push:
45
tags:
56
- v*
67
workflow_dispatch:
@@ -12,7 +13,7 @@ jobs:
1213
- name: "Set up Go"
1314
uses: actions/setup-go@v4
1415
with:
15-
go-version: 1.18
16+
go-version: 1.19
1617
- name: "Check out code"
1718
uses: actions/checkout@v3
1819
with:
@@ -21,6 +22,9 @@ jobs:
2122
uses: goreleaser/goreleaser-action@v4
2223
env:
2324
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
25+
SLACK_WEBHOOK: "${{ secrets.RELEASE_SLACK_WEBHOOK }}"
26+
DISCORD_WEBHOOK_ID: "${{ secrets.DISCORD_WEBHOOK_ID }}"
27+
DISCORD_WEBHOOK_TOKEN: "${{ secrets.DISCORD_WEBHOOK_TOKEN }}"
2428
with:
2529
args: "release --rm-dist"
2630
version: latest

.goreleaser.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
15
builds:
26
- binary: simplehttpserver
37
main: cmd/simplehttpserver/simplehttpserver.go
@@ -12,10 +16,20 @@ builds:
1216
- arm64
1317

1418
archives:
15-
- id: tgz
16-
format: tar.gz
17-
replacements:
18-
darwin: macOS
19-
format_overrides:
20-
- goos: windows
21-
format: zip
19+
- format: zip
20+
replacements:
21+
darwin: macOS
22+
23+
checksum:
24+
algorithm: sha256
25+
26+
announce:
27+
slack:
28+
enabled: true
29+
channel: '#release'
30+
username: GoReleaser
31+
message_template: 'New Release: {{ .ProjectName }} {{ .Tag }} is published! Check it out at {{ .ReleaseURL }}'
32+
33+
discord:
34+
enabled: true
35+
message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ This will display help for the tool. Here are all the switches it supports.
6565
| `-cert` | HTTPS/TLS certificate (self generated if not specified) | `simplehttpserver -cert cert.pem` |
6666
| `-key` | HTTPS/TLS certificate private key | `simplehttpserver -key cert.key` |
6767
| `-domain` | Domain name to use for the self-generated certificate | `simplehttpserver -domain projectdiscovery.io` |
68+
| `-cors` | Enable cross-origin resource sharing (CORS) | `simplehttpserver -cors` |
6869
| `-basic-auth` | Basic auth (username:password) | `simplehttpserver -basic-auth user:password` |
6970
| `-realm` | Basic auth message | `simplehttpserver -realm "insert the credentials"` |
7071
| `-version` | Show version | `simplehttpserver -version` |

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/projectdiscovery/simplehttpserver
22

3-
go 1.17
3+
go 1.19
44

55
require (
66
github.com/fsnotify/fsnotify v1.6.0

internal/runner/banner.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ const banner = `
88
\__ \/ / __ -__ \/ __ \/ / _ \/ /_/ / / / / / / /_/ / ___/ _ \/ ___/ | / / _ \/ ___/
99
___/ / / / / / / / /_/ / / __/ __ / / / / / / ____(__ ) __/ / | |/ / __/ /
1010
/____/_/_/ /_/ /_/ .___/_/\___/_/ /_/ /_/ /_/ /_/ /____/\___/_/ |___/\___/_/
11-
/_/ - v0.0.5
11+
/_/ - v0.0.6
1212
`
1313

1414
// Version is the current version
15-
const Version = `0.0.5`
15+
const Version = `0.0.6`
1616

1717
// showBanner is used to show the banner to the user
1818
func showBanner() {
1919
gologger.Print().Msgf("%s\n", banner)
2020
gologger.Print().Msgf("\t\tprojectdiscovery.io\n\n")
21-
22-
gologger.Print().Msgf("Use with caution. You are responsible for your actions\n")
23-
gologger.Print().Msgf("Developers assume no liability and are not responsible for any misuse or damage.\n")
2421
}

pkg/httpserver/uploadlayer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package httpserver
22

33
import (
44
"errors"
5-
"io/ioutil"
5+
"io"
66
"net/http"
77
"os"
88
"path"
@@ -55,7 +55,7 @@ func (t *HTTPServer) uploadlayer(handler http.Handler) http.Handler {
5555
r.Body = http.MaxBytesReader(w, r.Body, maxFileSize)
5656
}
5757

58-
data, err = ioutil.ReadAll(r.Body)
58+
data, err = io.ReadAll(r.Body)
5959
if err != nil {
6060
gologger.Print().Msgf("%s\n", err)
6161
w.WriteHeader(http.StatusInternalServerError)
@@ -95,5 +95,5 @@ func handleUpload(base, file string, data []byte) error {
9595
return errors.New("invalid path")
9696
}
9797

98-
return ioutil.WriteFile(trustedPath, data, 0655)
98+
return os.WriteFile(trustedPath, data, 0655)
9999
}

0 commit comments

Comments
 (0)