Skip to content

fix: workflow change #223

fix: workflow change

fix: workflow change #223

Workflow file for this run

name: Default
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
precommit:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.semrel.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: remove golangci from precommit-configuration
run: |
sed -i 's/.*id: golangci-lint//' .pre-commit-config.yaml
sed -i '/^\s*$/d' .pre-commit-config.yaml
- uses: pre-commit/[email protected]
continue-on-error: true
- uses: go-semantic-release/action@v1
id: semrel
with:
dry: true
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
build:
name: Build
strategy:
matrix:
go-version: [1.20.x]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg
~/.cache/go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
mkdir -p /tmp
make all
- uses: actions/upload-artifact@v4
with:
name: wattpilot_tools
path: |
shell/shell
prometheus/wattpilot_exporter
release:
name: Release
needs: [ precommit, build ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
changelog-file: CHANGELOG.md
- uses: rhysd/changelog-from-release/action@v2
if: steps.semrel.outputs.version != ''
with:
file: CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}