Skip to content

Commit

Permalink
update workflow dir
Browse files Browse the repository at this point in the history
  • Loading branch information
liweiyi88 committed Jan 29, 2023
1 parent d63b62c commit 24928b7
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write
packages: write
issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.5'
cache: true
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

workflow_dispatch:
jobs:
test:
strategy:
matrix:
go-version: [1.18, 1.19]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- run: |
go test -v -cover ./... -coverprofile coverage.out -coverpkg ./...
- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v1
if: ${{ runner.os == 'ubuntu-latest' && matrix.go == '1.19' }}
with:
green: 80
filename: coverage.out

- uses: stefanzweifel/git-auto-commit-action@v4
id: auto-commit-action
with:
commit_message: Apply Code Coverage Badge
skip_fetch: true
skip_checkout: true
file_pattern: ./README.md

- name: Push Changes
if: steps.auto-commit-action.outputs.changes_detected == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.ref }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.out

0 comments on commit 24928b7

Please sign in to comment.