mirror of
https://github.com/jimeh/macos-battery-exporter.git
synced 2026-02-19 01:16:40 +00:00
ci(release): setup CI workflows and release please (#1)
This commit is contained in:
3
.github/.release-please-manifest.json
vendored
Normal file
3
.github/.release-please-manifest.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
".": "0.0.0"
|
||||
}
|
||||
14
.github/release-please-config.json
vendored
Normal file
14
.github/release-please-config.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"initial-version": "0.0.1",
|
||||
"packages": {
|
||||
".": {
|
||||
"release-type": "go",
|
||||
"changelog-path": "CHANGELOG.md",
|
||||
"bump-minor-pre-major": true,
|
||||
"bump-patch-for-minor-pre-major": true,
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}
|
||||
},
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
||||
}
|
||||
47
.github/workflows/ci.yml
vendored
Normal file
47
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
name: CI
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.21"
|
||||
- name: Build binary
|
||||
run: make
|
||||
- name: Print version
|
||||
run: |
|
||||
./bin/macos-battery-exporter -v
|
||||
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main'
|
||||
outputs:
|
||||
release_created: ${{ steps.release-please.outputs.release_created }}
|
||||
version: ${{ steps.release-please.outputs.version }}
|
||||
steps:
|
||||
- uses: jimeh/release-please-manifest-action@v1
|
||||
id: release-please
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build, release-please]
|
||||
if: needs.release-please.outputs.release_created
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "1.21"
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BREW_TAP_TOKEN: ${{ secrets.BREW_TAP_TOKEN }}
|
||||
49
.goreleaser.yml
Normal file
49
.goreleaser.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- "-s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }}"
|
||||
goos:
|
||||
- "darwin"
|
||||
goarch:
|
||||
- "amd64"
|
||||
- "arm64"
|
||||
|
||||
universal_binaries:
|
||||
- replace: true
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
name_template: |-
|
||||
{{ .ProjectName }}-{{ .Version }}_{{ .Os }}_{{ if eq .Arch "all" }}universal{{ else }}{{ .Arch }}{{ end }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}
|
||||
wrap_in_directory: true
|
||||
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
|
||||
changelog:
|
||||
skip: true
|
||||
|
||||
brews:
|
||||
- name: macos-battery-exporter
|
||||
homepage: "https://github.com/jimeh/macos-battery-exporter"
|
||||
description: "Prometheus exporter for detailed battery metrics on macOS."
|
||||
license: "MIT"
|
||||
skip_upload: auto
|
||||
service: |
|
||||
run [bin/"macos-battery-exporter"]
|
||||
test: |
|
||||
system "#{bin}/macos-battery-exporter -v"
|
||||
repository:
|
||||
owner: jimeh
|
||||
name: homebrew-macos-battery-exporter
|
||||
branch: main
|
||||
token: "{{ .Env.BREW_TAP_TOKEN }}"
|
||||
Reference in New Issue
Block a user