diff --git a/.github/actions/create-release/action.yml b/.github/actions/create-release/action.yml new file mode 100644 index 0000000..1be9d55 --- /dev/null +++ b/.github/actions/create-release/action.yml @@ -0,0 +1,39 @@ +name: 'Create GitHub Release' +description: 'Creates a GitHub release with installation instructions' + +inputs: + tag: + description: 'The git tag for the release' + required: true + version: + description: 'The version number' + required: true + repository: + description: 'The GitHub repository (owner/name)' + required: true + +runs: + using: 'composite' + steps: + - name: Create Release + uses: ncipollo/release-action@v1 + with: + tag: ${{ inputs.tag }} + name: Release ${{ inputs.version }} + body: | + ## Installation + + To use this version in your Go project, run: + + ```bash + go get github.com/${{ inputs.repository }}@${{ inputs.tag }} + ``` + + Or add it to your `go.mod`: + + ```go + require github.com/${{ inputs.repository }} ${{ inputs.tag }} + ``` + generateReleaseNotes: true + draft: false + prerelease: false diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index ca804e6..09abbac 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -38,3 +38,35 @@ jobs: run: | go generate ./... go test ./pkg/... ./internal/... --tags=postgres + + verify-examples: + name: Run example ${{ matrix.example }} + runs-on: ubuntu-latest + strategy: + matrix: + example: + - sync-pull-dataplane + - streaming-pull-dataplane + - streaming-push-dataplane + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Go env + run: | + go env + go version + + - name: Run example + working-directory: examples/${{ matrix.example }} + run: | + go build . + go run . + + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5472731..b53f055 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,4 +35,23 @@ jobs: - name: Create and push tag uses: ./.github/actions/create-tag with: - tag: ${{ steps.normalize_version.outputs.tag }} \ No newline at end of file + tag: ${{ steps.normalize_version.outputs.tag }} + + create-release: + name: Create GitHub Release + runs-on: ubuntu-latest + needs: create-tag + + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create GitHub Release + uses: ./.github/actions/create-release + with: + tag: ${{ needs.create-tag.outputs.tag }} + version: ${{ needs.create-tag.outputs.version }} + repository: ${{ github.repository }} diff --git a/.github/workflows/release_bugfix.yml b/.github/workflows/release_bugfix.yml index f065658..e882e98 100644 --- a/.github/workflows/release_bugfix.yml +++ b/.github/workflows/release_bugfix.yml @@ -92,19 +92,8 @@ jobs: steps: - name: Create GitHub Release - uses: ncipollo/release-action@v1 + uses: ./.github/actions/create-release with: tag: ${{ needs.create-tag.outputs.tag }} - name: Release ${{ needs.create-tag.outputs.tag }} - generateReleaseNotes: true - makeLatest: ${{ needs.create-tag.outputs.is_latest == 'true' }} - body: | - NuGet packages published to GitHub Packages. - - ### Installation - ```bash - dotnet add package DataPlane.Sdk.Core --version ${{ needs.create-tag.outputs.version }} - dotnet add package DataPlane.Sdk.Api --version ${{ needs.create-tag.outputs.version }} - ``` - draft: false - prerelease: false + version: ${{ needs.create-tag.outputs.version }} + repository: ${{ github.repository }}