build docker images #27
Workflow file for this run
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
on: | |
pull_request: | |
push: | |
branches: [main] | |
permissions: | |
packages: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: build | |
run: nix develop --command make build | |
# - uses: HatsuneMiku3939/direnv-action@v0 | |
# - name: direnv allow | |
# run: direnv allow . | |
# - name: Build | |
# run: direnv exec . go build -v ./... | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- uses: HatsuneMiku3939/direnv-action@v1 | |
- name: direnv allow | |
run: direnv allow . | |
- name: go test | |
run: direnv exec . go test -v ./... | |
- name: go lint | |
run: direnv exec . golangci-lint run | |
- name: go mod tidy | |
run: direnv exec . go mod tidy | |
- name: gen proto | |
run: direnv exec . make gen | |
- name: exit if changed | |
run: git diff --exit-code | |
nix-build: | |
name: Build nix package | |
runs-on: ubuntu-latest | |
needs: [build, test] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- uses: DeterminateSystems/flake-checker-action@main | |
- name: Build package | |
run: nix build . | |
docker-build: | |
name: Build docker image | |
runs-on: ubuntu-latest | |
# needs: [nix-build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Build image | |
run: nix build .#docker | |
- uses: HatsuneMiku3939/direnv-action@v1 | |
- name: direnv allow | |
run: direnv allow . | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push image | |
run: direnv exec . skopeo copy "docker-archive:result" "docker://ghcr.io/connet-dev/connet:latest" |