Skip to content

Commit

Permalink
feat(ci): add release when tagging (#14)
Browse files Browse the repository at this point in the history
* feat(ci): add release when tagging

Signed-off-by: Felipe Zipitria <[email protected]>
  • Loading branch information
fzipi authored Nov 2, 2022
1 parent ace3e78 commit f590326
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}

89 changes: 89 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
description:
CRS ToolChain helper

license: APL2


0 comments on commit f590326

Please sign in to comment.