From ba6c81e9cb58f163a0f9ded6040199e86b747b47 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Tue, 28 Feb 2023 19:56:02 -0800 Subject: [PATCH] fix: updated ci --- .../workflows/{main.yml => pull_request.yml} | 48 +++++++++++++++---- .github/workflows/push_main.yml | 29 +++++++++++ .releaserc | 10 ++++ 3 files changed, 77 insertions(+), 10 deletions(-) rename .github/workflows/{main.yml => pull_request.yml} (58%) create mode 100644 .github/workflows/push_main.yml create mode 100644 .releaserc diff --git a/.github/workflows/main.yml b/.github/workflows/pull_request.yml similarity index 58% rename from .github/workflows/main.yml rename to .github/workflows/pull_request.yml index 2d19dea..c57f64e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/pull_request.yml @@ -1,49 +1,77 @@ --- -on: [push, pull_request] # yamllint disable-line rule:truthy +on: [pull_request] # yamllint disable-line rule:truthy name: main jobs: + commitlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-node@v1 + + - uses: actions/setup-node@v3 with: - node-version: 14 + node-version: lts/* - run: npm install --save-dev @commitlint/{config-conventional,cli} - run: npx commitlint --from=${{ github.event.pull_request.base.sha }} + golangci-lint: strategy: matrix: - go-version: [1.18.x] + go-version: [1.20.x] os: [ubuntu-latest, macos-latest] name: lint runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + + - uses: actions/checkout@v3 + - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.46 + version: v1.51.1 + yamllint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: yaml-lint uses: ibiqlik/action-yamllint@v3 + + hadolint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: hadolint/hadolint-action@v2.0.0 + with: + dockerfile: Dockerfile + test: strategy: matrix: - go-version: [1.18.x] + go-version: [1.20.x] os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: + - name: Install Go uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} + - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Test run: go test ./... diff --git a/.github/workflows/push_main.yml b/.github/workflows/push_main.yml new file mode 100644 index 0000000..a2d130c --- /dev/null +++ b/.github/workflows/push_main.yml @@ -0,0 +1,29 @@ +--- +name: Release Version + +on: # yamllint disable-line rule:truthy + push: + branches: + - main + +jobs: + release: + name: 'Release to GitHub' + runs-on: ubuntu-latest + steps: + + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: lts/* + + - name: Install Semantic Release Plugins + run: npm install --save-dev @semantic-release/changelog @semantic-release/git conventional-changelog-conventionalcommits # yamllint disable-line rule:line-length + + - name: Release Version + env: + GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }} + run: npx semantic-release diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..90f6712 --- /dev/null +++ b/.releaserc @@ -0,0 +1,10 @@ +--- +branches: +- master +- main +plugins: +- - "@semantic-release/commit-analyzer" + - preset: conventionalcommits +- - "@semantic-release/release-notes-generator" + - preset: conventionalcommits +- - "@semantic-release/github" \ No newline at end of file