这是indexloc提供的服务,不要输入任何密码
Skip to content

publish statically-linked connector binaries with github releases #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 40 additions & 33 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,8 @@ on:
- 'v*'

jobs:
binary:
name: deploy::binary
runs-on: ubuntu-24.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install Nix ❄
uses: DeterminateSystems/nix-installer-action@v4

- name: Link Cachix 🔌
uses: cachix/cachix-action@v12
with:
name: '${{ vars.CACHIX_CACHE_NAME }}'
authToken: '${{ secrets.CACHIX_CACHE_AUTH_TOKEN }}'

- name: Login to GitHub Container Registry 📦
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build the crate using nix 🔨
run: nix build --print-build-logs

- name: Create release 🚀
uses: actions/upload-artifact@v4
with:
name: mongodb-connector
path: result/bin/mongodb-connector

docker:
name: deploy::docker
needs: binary

# This job doesn't work as written on ubuntu-24.04. The problem is described
# in this issue: https://github.com/actions/runner-images/issues/10443
Expand Down Expand Up @@ -91,6 +58,45 @@ jobs:
path: ./connector-definition/dist/connector-definition.tgz
compression-level: 0 # Already compressed

# Builds with nix for simplicity
build-connector-binaries:
name: build the connector binaries
strategy:
matrix:
include:
- target: x86_64-linux
- target: aarch64-linux
runs-on: ubuntu-24.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install Nix ❄
uses: DeterminateSystems/nix-installer-action@v4

- name: Link Cachix 🔌
uses: cachix/cachix-action@v12
with:
name: '${{ vars.CACHIX_CACHE_NAME }}'
authToken: '${{ secrets.CACHIX_CACHE_AUTH_TOKEN }}'

- name: Login to GitHub Container Registry 📦
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build statically-linked binary 🔨
run: nix build --print-build-logs .#mongodb-connector-${{ matrix.target }}

- name: Upload binaries to workflow artifacts 🚀
uses: actions/upload-artifact@v4
with:
name: mongodb-connector-${{ matrix.target }}
path: result/bin/mongodb-connector

# Builds without nix to get Windows binaries
build-cli-binaries:
name: build the CLI binaries
strategy:
Expand Down Expand Up @@ -187,6 +193,7 @@ jobs:
needs:
- docker
- connector-definition
- build-connector-binaries
- build-cli-binaries
runs-on: ubuntu-24.04
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
Expand Down