nix:deploy #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nix:deploy | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
jobs: | |
binary: | |
name: deploy::binary | |
runs-on: ubuntu-latest | |
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@v3 | |
with: | |
name: mongodb-connector | |
path: result/bin/mongodb-connector | |
docker: | |
name: deploy::docker | |
needs: binary | |
runs-on: ubuntu-latest | |
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: Deploy π | |
run: nix run .#publish-docker-image ${{ github.ref }} |