Skip to content

Add release step to CI #152

Add release step to CI

Add release step to CI #152

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- "**"
permissions:
contents: write
packages: write
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run tests
run: make test
integration-test:
name: integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run integration tests
run: make integration-test
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.58.1
# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
args: --timeout=30m --out-format=colored-line-number --config=.golangci.yml
license-check:
name: license check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Ensure .go files have a license reference
run: make license-check
build:
runs-on: ubuntu-latest
needs: [test, lint, integration-test]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Build pgstream (Linux amd64)
run: GOOS=linux GOARCH=amd64 go build -o pgstream.linux.amd64
- name: Build pgstream (Linux arm64)
run: GOOS=linux GOARCH=arm64 go build -o pgstream.linux.arm64
- name: Build pgstream (MacOS amd64)
run: GOOS=darwin GOARCH=amd64 go build -o pgstream.macos.amd64
- name: Build pgstream (MacOS arm64)
run: GOOS=darwin GOARCH=arm64 go build -o pgstream.macos.arm64
- name: Build pgstream (Windows)
run: GOOS=windows GOARCH=amd64 go build -o pgstream.win.amd64
- uses: actions/upload-artifact@v3
with:
name: pgstream.linux.amd64
path: pgstream.linux.amd64
- uses: actions/upload-artifact@v3
with:
name: pgstream.linux.arm64
path: pgstream.linux.arm64
- uses: actions/upload-artifact@v3
with:
name: pgstream.macos.amd64
path: pgstream.macos.amd64
- uses: actions/upload-artifact@v3
with:
name: pgstream.macos.arm64
path: pgstream.macos.arm64
- uses: actions/upload-artifact@v3
with:
name: pgstream.win.amd64
path: pgstream.win.amd64
release:
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
artifacts/pgstream.linux.amd64/pgstream.linux.amd64
artifacts/pgstream.linux.arm64/pgstream.linux.arm64
artifacts/pgstream.macos.amd64/pgstream.macos.amd64
artifacts/pgstream.macos.arm64/pgstream.macos.arm64
artifacts/pgstream.win.amd64/pgstream.win.amd64