From 85aa083114192bc3a766865deb60f74f694d1d15 Mon Sep 17 00:00:00 2001 From: Dhrumil Mistry <56185972+dmdhrumilmistry@users.noreply.github.com> Date: Wed, 28 Aug 2024 23:46:14 +0530 Subject: [PATCH 1/5] update workflows --- .github/workflows/dev-push.yml | 2 +- .github/workflows/release-push.yml | 2 +- src/.goreleaser.yaml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-push.yml b/.github/workflows/dev-push.yml index 0965bdc..30b2374 100644 --- a/.github/workflows/dev-push.yml +++ b/.github/workflows/dev-push.yml @@ -31,7 +31,7 @@ jobs: uses: docker/build-push-action@v3 with: context: ./src/ - file: ./src/DockerFile + file: ./src/Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/offat:${{ github.head_ref || github.ref_name }} # for release: ${{ github.event.release.tag_name }} platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 diff --git a/.github/workflows/release-push.yml b/.github/workflows/release-push.yml index 0d6b313..3fe55d4 100644 --- a/.github/workflows/release-push.yml +++ b/.github/workflows/release-push.yml @@ -29,7 +29,7 @@ jobs: uses: docker/build-push-action@v3 with: context: ./src/ - file: ./src/DockerFile + file: ./src/Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/offat:${{ github.event.release.tag_name }} # for dev: ${{ github.head_ref || github.ref_name }} platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 diff --git a/src/.goreleaser.yaml b/src/.goreleaser.yaml index f0ff055..24ab836 100644 --- a/src/.goreleaser.yaml +++ b/src/.goreleaser.yaml @@ -18,6 +18,7 @@ before: builds: - env: - CGO_ENABLED=0 + main: ./src/cmd/offat/ goos: - linux - windows From 15b1230d6926637efa3bb0d5305e48e193b4bd36 Mon Sep 17 00:00:00 2001 From: Dhrumil Mistry <56185972+dmdhrumilmistry@users.noreply.github.com> Date: Wed, 28 Aug 2024 23:54:05 +0530 Subject: [PATCH 2/5] update goreleaser config --- src/.goreleaser.yaml | 77 ++++++++++++++++++++++++++++---------------- src/LICENSE | 19 +++++++++++ 2 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 src/LICENSE diff --git a/src/.goreleaser.yaml b/src/.goreleaser.yaml index 24ab836..163ff82 100644 --- a/src/.goreleaser.yaml +++ b/src/.goreleaser.yaml @@ -1,47 +1,68 @@ -# This is an example .goreleaser.yml file with some sensible defaults. -# Make sure to check the documentation at https://goreleaser.com - -# The lines below are called `modelines`. See `:help modeline` -# Feel free to remove those if you don't want/need to use them. -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj - -version: 2 +project_name: amass before: hooks: - # You may remove this if you don't use go modules. - - go mod tidy - # you may remove this if you don't need go generate - - go generate ./... + - go mod tidy + - go mod download builds: - - env: - - CGO_ENABLED=0 - main: ./src/cmd/offat/ + - + main: ./cmd/offat/ + binary: offat goos: - - linux - windows + - linux - darwin + - freebsd + goarch: + - amd64 + - 386 + - arm + - arm64 + ignore: + - goos: darwin + goarch: 386 + - goos: darwin + goarch: arm + - goos: windows + goarch: 386 + - goos: windows + goarch: arm + - goos: windows + goarch: arm64 + - goos: freebsd + goarch: arm archives: - - format: tar.gz - # this name template makes the OS and Arch compatible with the results of `uname`. + - name_template: >- {{ .ProjectName }}_ {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 + {{- if eq .Arch "darwin" }}macos {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }} - # use zip for windows archives - format_overrides: - - goos: windows - format: zip + wrap_in_directory: true + format: zip + files: + - LICENSE + - README.md + +sboms: + - documents: + - "{{ .Binary }}_{{ .Os }}_{{ .Arch }}.bom.json" + artifacts: binary + cmd: cyclonedx-gomod + env: + - GOOS={{ .Os }} + - GOARCH={{ .Arch }} + args: [ "app", "-main", "cmd/offat", "-licenses", "-packages", "-json", "-output", "$document", "../" ] + +checksum: + name_template: "{{ .ProjectName }}_checksums.txt" changelog: - sort: asc + sort: desc filters: exclude: - - "^docs:" - - "^test:" + - '^MERGE' + - "{{ .Tag }}" \ No newline at end of file diff --git a/src/LICENSE b/src/LICENSE new file mode 100644 index 0000000..9cf1062 --- /dev/null +++ b/src/LICENSE @@ -0,0 +1,19 @@ +MIT License + +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. From 97f0d58ea7f8fdd15c9348899f1166ed2a013e4a Mon Sep 17 00:00:00 2001 From: Dhrumil Mistry <56185972+dmdhrumilmistry@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:04:50 +0530 Subject: [PATCH 3/5] update workflows --- .github/FUNDING.yml | 2 ++ .github/workflows/goreleaser.yml | 38 ++++++++++++++++++++++++++++++ .github/workflows/test-project.yml | 2 +- src/.goreleaser.yaml | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/goreleaser.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..4fc58e4 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +custom: https://owasp.org/donate/?reponame=offat&title=OWASP+OFFAT +github: OWASP \ No newline at end of file diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..0532aa1 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,38 @@ +name: goreleaser + +on: + push: + tags: + - 'v*.*.*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.23 + + - name: set up CycloneDX + uses: CycloneDX/gh-gomod-generate-sbom@v2 + with: + version: v1 + + - name: run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.OFFAT_GH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml index d828d90..5403c42 100644 --- a/.github/workflows/test-project.yml +++ b/.github/workflows/test-project.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.22.x' + go-version: '1.23.x' - name: Install Dependencies run: go mod download diff --git a/src/.goreleaser.yaml b/src/.goreleaser.yaml index 163ff82..26981d0 100644 --- a/src/.goreleaser.yaml +++ b/src/.goreleaser.yaml @@ -1,4 +1,4 @@ -project_name: amass +project_name: offat before: hooks: From ff2f2525c95a8ab38e0809b8bc3e5e84ccdd17d2 Mon Sep 17 00:00:00 2001 From: Dhrumil Mistry <56185972+dmdhrumilmistry@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:10:45 +0530 Subject: [PATCH 4/5] update goreleaser config --- src/.goreleaser.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/.goreleaser.yaml b/src/.goreleaser.yaml index 26981d0..89f39f5 100644 --- a/src/.goreleaser.yaml +++ b/src/.goreleaser.yaml @@ -1,3 +1,7 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=jcroql +version: 2 + project_name: offat before: @@ -6,8 +10,7 @@ before: - go mod download builds: - - - main: ./cmd/offat/ + - main: ./cmd/offat/ binary: offat goos: - windows @@ -34,8 +37,7 @@ builds: goarch: arm archives: - - - name_template: >- + - name_template: >- {{ .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "darwin" }}macos From e5086ef62b07f03dce612b98244a7aef05082e1b Mon Sep 17 00:00:00 2001 From: Dhrumil Mistry <56185972+dmdhrumilmistry@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:14:54 +0530 Subject: [PATCH 5/5] update workflow --- .github/workflows/goreleaser.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 0532aa1..1f9b32b 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -30,6 +30,7 @@ jobs: - name: run GoReleaser uses: goreleaser/goreleaser-action@v6 + working-directory: ./src with: distribution: goreleaser version: latest