diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cdb3f14 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Build + run: make build-all + + - name: Test + run: make test + + - name: Lint + uses: golangci/golangci-lint-action@v4 + with: + version: latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0231dfd..42b477b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,17 @@ name: Release on: - push: - tags: - - 'v*' - workflow_call: + workflow_dispatch: inputs: - tag: - description: 'Git tag to release' - required: true - type: string + bump: + description: 'Version bump type' + required: false + type: choice + options: + - patch + - minor + - major + default: 'patch' permissions: contents: write @@ -22,7 +24,14 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ inputs.tag || github.ref }} + + - name: Bump version and push tag + id: tag + uses: mathieudutour/github-tag-action@v6.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + default_bump: ${{ github.event.inputs.bump }} + tag_prefix: v - name: Set up Go uses: actions/setup-go@v5 @@ -37,3 +46,12 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Summary + run: | + echo "## Release ${{ steps.tag.outputs.new_tag }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Previous tag:** ${{ steps.tag.outputs.previous_tag }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Changelog" >> $GITHUB_STEP_SUMMARY + echo "${{ steps.tag.outputs.changelog }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/tag-release.yaml b/.github/workflows/tag-release.yaml deleted file mode 100644 index 3db3665..0000000 --- a/.github/workflows/tag-release.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Tag and Release - -on: - workflow_dispatch: - inputs: - bump: - description: 'Version bump type' - required: false - type: choice - options: - - patch - - minor - - major - default: 'patch' - -permissions: - contents: write - -jobs: - create-tag: - runs-on: ubuntu-latest - outputs: - new_tag: ${{ steps.tag.outputs.new_tag }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Bump version and push tag - id: tag - uses: mathieudutour/github-tag-action@v6.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - default_bump: ${{ github.event.inputs.bump }} - tag_prefix: v - - - name: Summary - run: | - echo "## Release ${{ steps.tag.outputs.new_tag }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "**Previous tag:** ${{ steps.tag.outputs.previous_tag }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Changelog" >> $GITHUB_STEP_SUMMARY - echo "${{ steps.tag.outputs.changelog }}" >> $GITHUB_STEP_SUMMARY - - release: - needs: create-tag - uses: ./.github/workflows/release.yml - with: - tag: ${{ needs.create-tag.outputs.new_tag }} - permissions: - contents: write