From 46f0194ea744059100d6da5435125b598eb59bc8 Mon Sep 17 00:00:00 2001 From: Stanislas Lange Date: Sun, 23 May 2021 22:23:00 +0000 Subject: [PATCH] ci: add release workflow, commitlint --- .github/workflows/build.yml | 57 +++++++++++++++++++++++++++++-------- .github/workflows/push.yml | 18 ++++++++++++ releaserc.json | 10 +++++++ 3 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/push.yml create mode 100644 releaserc.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 430bc3b..3a1c8b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,22 +1,55 @@ -name: Pipeline +name: Push workflow on: push jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.16' + - name: Run build + run: | + go build . - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: '1.16' + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.16' + - name: Run go vet + run: go vet . - - name: Run build - run: | - go build . + commitlint: + name: Commit Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Lint Commit + uses: wagoid/commitlint-github-action@v3 - - name: Run go vet - run: go vet . + release: + name: Release + needs: [build, lint, commitlint] + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} + run: npx semantic-release diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..fe88b1e --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,18 @@ +name: Release workflow + +on: + release: + types: [created] + +jobs: + release-linux-amd64: + name: release linux/amd64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Publish binaries to release + uses: wangyoucao577/go-release-action@v1.17 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: linux + goarch: amd64 diff --git a/releaserc.json b/releaserc.json new file mode 100644 index 0000000..0cab322 --- /dev/null +++ b/releaserc.json @@ -0,0 +1,10 @@ +{ + "branches": [ + "main" + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github" + ] +}