blob: cd14344074b909ce428b219343b4238343e19a18 (
plain) (
blame)
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
46
47
48
49
50
51
52
53
54
55
56
|
name: Build and push docker image
on:
pull_request:
push:
branches:
- 'master'
tags:
- '*'
env:
TEST_TAG: fretlink/link
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
base_os:
- debian
- alpine
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and export to Docker
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.base_os }}/Dockerfile
load: true
tags: ${{ env.TEST_TAG }}
- name: Test
run: |
docker run --rm ${{ env.TEST_TAG }} 'nix-channel --list'
docker run --rm ${{ env.TEST_TAG }} 'nix-env -iA nixpkgs.hello && test "$(hello)" = "Hello, world!"'
- name: Get the version
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Login to DockerHub
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
context: .
file: ${{ matrix.base_os }}/Dockerfile
tags: fretlink/nix:${{ steps.get_version.outputs.VERSION }}-${{ matrix.base_os }}
|