diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5570e31..b97a644 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,6 +5,10 @@ version: 2 updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" - package-ecosystem: "gomod" directory: "/" schedule: diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml new file mode 100644 index 0000000..9beef23 --- /dev/null +++ b/.github/workflows/conventional-commits.yml @@ -0,0 +1,16 @@ +# The below is pulled from upstream and slightly modified +# https://github.com/webiny/action-conventional-commits/blob/master/README.md#usage + +name: Conventional Commits + +on: + pull_request: + +jobs: + build: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: webiny/action-conventional-commits@v1.3.0 diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml new file mode 100644 index 0000000..e92b1c5 --- /dev/null +++ b/.github/workflows/go-test.yml @@ -0,0 +1,24 @@ +name: go-test + +on: + push: + tags: + - v* + branches: + - main + pull_request: + +jobs: + go-test: + name: go-test + strategy: + matrix: + go-version: [1.21.x, 1.22.x] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + - name: go-test + run: go test ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..f1dbe5a --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,32 @@ +# This file was copied from the following URL and modified: +# https://github.com/golangci/golangci-lint-action/blob/master/README.md#how-to-use + +name: golangci-lint +on: + push: + tags: + - v* + branches: + - main + pull_request: + +permissions: + contents: read + pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 1.21.x + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v4 + with: + args: --timeout=10m + # Only show new issues in a PR but show all issues for pushes + only-new-issues: ${{ github.event_name == 'pull_request' && 'true' || 'false' }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..328b9a9 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,40 @@ +name: publish + +on: + push: + tags: + - 'v*.*.*' + +concurrency: ${{ github.ref }} + +jobs: + create-release: + runs-on: ubuntu-latest + outputs: + RELEASE_ID: ${{ steps.create-release.outputs.result }} + steps: + - run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV" + - uses: actions/github-script@v7 + id: create-release + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + try { + const response = await github.rest.repos.createRelease({ + generate_release_notes: true, + name: process.env.RELEASE_TAG, + owner: context.repo.owner, + prerelease: false, + repo: context.repo.repo, + tag_name: process.env.RELEASE_TAG, + }); + + return response.data.id; + } catch (error) { + core.setFailed(error.message); + } + + # This updates the documentation on pkg.go.dev and the latest version available via the Go module proxy + - name: Pull new module version + uses: andrewslotin/go-proxy-pull-action@v1.1.0