Skip to content

Commit

Permalink
chore(ci): add release script + cleanup dependencies before release (…
Browse files Browse the repository at this point in the history
…see samber/lo#50)
  • Loading branch information
samber committed Dec 15, 2022
1 parent a430009 commit d02bc17
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: golangci-lint
name: Lint

on:
push:
tags:
branches:
pull_request:

jobs:
golangci:
name: lint
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on:
workflow_dispatch:
inputs:
semver:
type: string
description: Release semver
required: true

jobs:
release:
if: github.triggering_actor == 'samber'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
stable: false

- name: Test
run: make test

# remove tests in order to clean dependencies
- name: Remove xxx_test.go files
run: rm -rf *_test.go docker-compose.yml

- name: Cleanup dependencies
run: go mod tidy

- name: List files
run: tree -Cfi
- name: Write new go.mod into logs
run: cat go.mod
- name: Write new go.sum into logs
run: cat go.sum

- name: Create tag
run: |
git config --global user.name '${{ github.triggering_actor }}'
git config --global user.email "${{ github.triggering_actor}}@users.noreply.github.com"
git add .
git commit -m 'bump ${{ inputs.semver }}'
git tag ${{ inputs.semver }}
git push origin ${{ inputs.semver }}
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ inputs.semver }}
tag_name: ${{ inputs.semver }}
2 changes: 1 addition & 1 deletion .github/workflows/go.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go
name: Tests

on:
push:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
# do - Dependency Injection

[![tag](https://img.shields.io/github/tag/samber/do.svg)](https://github.com/samber/do/releases)
![Go Version](https://img.shields.io/badge/Go-%3E%3D%201.18-%23007d9c)
[![GoDoc](https://godoc.org/github.com/samber/do?status.svg)](https://pkg.go.dev/github.com/samber/do)
![Build Status](https://github.com/samber/do/actions/workflows/go.yml/badge.svg)
[![Go report](https://goreportcard.com/badge/github.com/samber/do)](https://goreportcard.com/report/github.com/samber/do)
[![codecov](https://codecov.io/gh/samber/do/branch/master/graph/badge.svg)](https://codecov.io/gh/samber/do)
[![Coverage](https://img.shields.io/codecov/c/github/samber/do)](https://codecov.io/gh/samber/do)
[![License](https://img.shields.io/github/license/samber/do)](./LICENSE)

**⚙️ A dependency injection toolkit based on Go 1.18+ Generics.**

Expand Down

0 comments on commit d02bc17

Please sign in to comment.