diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..3afdf71 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,47 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ main, develop ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main, develop ] + schedule: + - cron: '33 8 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0746e03 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: goreleaser + +on: + push: + tags: + - '*' + +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.19 + cache: true + - + name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + if: startsWith(github.ref, 'refs/tags/') + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..b9810fd --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,89 @@ +# This is an example .goreleaser.yml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +project_name: crs-toolchain +before: + hooks: + # You may remove this if you don't use go modules. + - go mod download +builds: + - id: "crs-toolchain" + env: + - CGO_ENABLED=0 + binary: crs-toolchain + targets: + - linux_amd64 + - linux_arm64 + - darwin_amd64 + - darwin_arm64 + - windows_amd64 +archives: + - format_overrides: + - goos: windows + format: zip +checksum: + name_template: '{{ .ProjectName }}-checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + use: github + groups: + - title: Features + regexp: "^.*feat[(\\w)]*:+.*$" + order: 0 + - title: 'Bug fixes' + regexp: "^.*fix[(\\w)]*:+.*$" + order: 1 + - title: Others + order: 999 + filters: + exclude: + - '^docs' + - '^test' +release: + prerelease: auto +dockers: + - image_templates: + - "ghcr.io/theseion/crs-toolchain:{{ .Version }}-amd64" + use: buildx + goarch: amd64 + build_flag_templates: + - "--platform=linux/amd64" + - image_templates: + - "ghcr.io/theseion/crs-toolchain:{{ .Version }}-arm64" + use: buildx + goarch: arm64 + build_flag_templates: + - "--platform=linux/arm64" +docker_manifests: + - name_template: "ghcr.io/theseion/crs-toolchain:latest" + image_templates: + - "ghcr.io/theseion/crs-toolchain:{{ .Version }}-amd64" + - "ghcr.io/theseion/crs-toolchain:{{ .Version }}-arm64" + - name_template: "ghcr.io/theseion/crs-toolchain:{{ .Version }}" + image_templates: + - "ghcr.io/theseion/crs-toolchain:{{ .Version }}-amd64" + - "ghcr.io/theseion/crs-toolchain:{{ .Version }}-arm64" +nfpms: + - id: "crs-toolchain" + builds: ["crs-toolchain"] + formats: + - deb + - rpm + bindir: /usr/bin + overrides: + rpm: + replacements: + amd64: x86_64 + file_name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Arch }}" + deb: + file_name_template: "{{ .ProjectName }}-{{ .Version }}_{{ .Arch }}" + vendor: + homepage: https://github.com/theseion/crs-toolchain + maintainer: th3s3ion@gmail.com + description: + CRS ToolChain helper + + license: APL2 + +