Skip to content

chore: release v0.6.7 #573

chore: release v0.6.7

chore: release v0.6.7 #573

Workflow file for this run

name: "🤖 Check: 'gdenv'"
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: write
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 4
outputs:
has_source_change: ${{ steps.check-source.outputs.any_modified }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for any Go source code changes
id: check-source
uses: tj-actions/changed-files@v40
with:
files: |
**/*.go
go.mod
go.sum
format:
needs: ["changes"]
if: needs.changes.outputs.has_source_change == 'true'
runs-on: ubuntu-latest
timeout-minutes: 4
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
# Checkout the "head_ref" (i.e. PR branch HEAD) in case a commit is
# later needed. See https://github.com/stefanzweifel/git-auto-commit-action
# for more details.
ref: ${{ github.head_ref }}
# Use a PAT so that GitHub Actions will trigger on the resulting commit.
token: ${{ secrets.ACTIONS_BOT }}
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Check formatting of source code
id: format
continue-on-error: true
run: |
go install golang.org/x/tools/cmd/goimports@latest
test -z $(gofmt -l .)
test -z $(goimports -local github.com/coffeebeats/gdenv -l .)
- name: Fix formatting of source code
if: steps.format.outcome == 'failure'
run: |
gofmt -w .
goimports -local github.com/coffeebeats/gdenv -w .
# See https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add --all '*.go'
git commit -m "chore: fix formatting (on behalf of '${{ github.triggering_actor }}')"
git push
- name: Terminate CI run early
if: steps.format.outcome == 'failure'
run: exit 1
lint:
needs: ["changes"]
if: needs.changes.outputs.has_source_change == 'true'
runs-on: ubuntu-latest
timeout-minutes: 4
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
cache: false # See https://github.com/golangci/golangci-lint-action/issues/135.
go-version-file: "go.mod"
- name: Lint source code
uses: golangci/golangci-lint-action@v3
with:
version: latest
build:
needs: ["changes", "format", "lint"]
if: needs.changes.outputs.has_source_change == 'true'
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Build source code
shell: bash
run: go build -v ./...
test:
needs: ["changes", "format", "lint"]
if: needs.changes.outputs.has_source_change == 'true'
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Test source code
shell: bash
run: go test -race -covermode=atomic -coverprofile=coverage.out ./...
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
flags: gdenv
token: ${{ secrets.CODECOV_TOKEN }}
# Used to ensure all branch protection requirements are met. This is a workaround until
# https://github.com/github-community/community/discussions/4324 is addressed.
branch_protection:
needs: ["format", "lint", "build", "test"]
if: ${{ always() }}
runs-on: ubuntu-latest
timeout-minutes: 1
defaults:
run:
shell: bash
steps:
- name: Verify 'format' status
if: |
always() &&
needs.format.result == 'failure' ||
needs.format.result == 'cancelled'
shell: bash
run: exit 1
- name: Verify 'lint' status
if: |
always() &&
needs.lint.result == 'failure' ||
needs.lint.result == 'cancelled'
shell: bash
run: exit 1
- name: Verify 'build' status
if: |
always() &&
needs.build.result == 'failure' ||
needs.build.result == 'cancelled'
shell: bash
run: exit 1
- name: Verify 'test' status
if: |
always() &&
needs.test.result == 'failure' ||
needs.test.result == 'cancelled'
shell: bash
run: exit 1