-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
45 lines (45 loc) · 1.77 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: "Build and push nix-based contaienr image"
description: "Builds a nix-expression into a docker image, optionally pushing it to a registry."
branding:
color: purple
icon: gift
inputs:
src:
description: "The nix-expression to build that will result in a docker image"
required: true
default: "docker.nix"
registry:
description: "The docker registry to upload to, e.g. `registry.example.com`"
required: false
path:
description: "The path on the registry to upload to, e.g. `/main-project/example-service`"
required: false
username:
description: "Username to authenticate to registry with"
required: false
password:
description: "Password to authenticate to registry with"
required: false
tag:
description: "Tag to use for the uploaded image. If not given, determine automatically. `main` and `master` are always translated to the tag `latest`; otherwise versions"
required: false
nixpkgs:
description: "Path to the version of nixpkgs used for the upload. Anything that can be used with the `-I` option of `nix-shell`. Default is the `21.11` tag of nixpkgs."
required: false
default: "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.11.tar.gz"
runs:
using: "composite"
steps:
- name: "Build the docker-image"
shell: sh
run: nix-build --out-link /tmp/nix-container-build ${{ inputs.src }}
- name: "Upload image to registry"
shell: sh
run: nix-shell -I nixpkgs="${{ inputs.nixpkgs }}" -p skopeo --run "${{ github.action_path }}/upload.sh"
env:
REGISTRY: ${{ inputs.registry }}
USERNAME: ${{ inputs.username }}
PASSWORD: ${{ inputs.password }}
REPO_PATH: ${{ inputs.path }}
INPUT_TAG: ${{ inputs.tag }}
GITHUB_REF: ${{ github.ref }}