Skip to content

Add support for Discord webhook #566

Add support for Discord webhook

Add support for Discord webhook #566

Workflow file for this run

name: ci
on:
push:
pull_request:
jobs:
golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: actions/setup-go@v5
with:
go-version: "^1.20"
- uses: golangci/[email protected]
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: actions/setup-go@v5
with:
go-version: "^1.20"
- name: run tests on cmd
run: go test ./cmd
- name: run tests on pkg
run: go test ./pkg -timeout 120s -coverprofile=cover.out -covermode=atomic
- uses: codecov/codecov-action@v5
with:
files: ./cover.out
version_tag:
if: github.event.repository.fork == false && github.actor != 'dependabot[bot]'
needs:
- tests
- golangci
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.tag_action.outputs.new_tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Bump version and push tag
if: github.ref == 'refs/heads/main'
id: tag_action
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
PRERELEASE: ${{ github.ref != 'refs/heads/main' }}
build:
if: github.event.repository.fork == false && github.actor != 'dependabot[bot]'
needs: version_tag
runs-on: ubuntu-latest
env:
CGO_ENABLED: 0
strategy:
matrix:
goos: [linux, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
## build tailwind assets
- uses: actions/setup-node@v4
with:
node-version: '19'
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install
- run: npm run build
## setup go
- uses: actions/setup-go@v5
with:
go-version: "^1.22"
## above is fine to get latest for now, also save a copy with short sha
- id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- run: mkdir -p ${{ matrix.goos }}/${{ matrix.goarch }}
- run: env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-X 'github.com/datarootsio/cheek/pkg.version=${{ needs.version_tag.outputs.new_tag }}' -X 'github.com/datarootsio/cheek/pkg.commitSHA=${{ steps.vars.outputs.sha_short }}'" -o ${{ matrix.goos }}/${{ matrix.goarch }}
- run: cp ${{ matrix.goos }}/${{ matrix.goarch }}/cheek ${{ matrix.goos }}/${{ matrix.goarch }}/cheek-${{ steps.vars.outputs.sha_short }}
- run: cp ${{ matrix.goos }}/${{ matrix.goarch }}/cheek ${{ matrix.goos }}/${{ matrix.goarch }}/cheek-${{ needs.version_tag.outputs.new_tag }}
## upload binary to google storage
- id: auth
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.gcp_credentials_cheek }}
- id: upload-files
uses: google-github-actions/[email protected]
with:
path: ${{ matrix.goos }}/${{ matrix.goarch }}/cheek-${{ steps.vars.outputs.sha_short }}
destination: cheek-scheduler/${{ matrix.goos }}/${{ matrix.goarch }}/
- uses: google-github-actions/[email protected]
if: github.ref == 'refs/heads/main'
with:
path: ${{ matrix.goos }}/${{ matrix.goarch }}/cheek-${{ needs.version_tag.outputs.new_tag }}
destination: cheek-scheduler/${{ matrix.goos }}/${{ matrix.goarch }}/
- uses: google-github-actions/[email protected]
if: github.ref == 'refs/heads/main'
with:
path: ${{ matrix.goos }}/${{ matrix.goarch }}/cheek
destination: cheek-scheduler/${{ matrix.goos }}/${{ matrix.goarch }}/
docker-build:
## only do this on main
needs:
- build
- version_tag
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/datarootsio/cheek:latest
ghcr.io/datarootsio/cheek:${{ needs.version_tag.outputs.new_tag }}