1 name: Build and push docker image
12 TEST_TAG: fretlink/link
16 runs-on: ubuntu-latest
24 uses: actions/checkout@v2
25 - name: Set up Docker Buildx
26 uses: docker/setup-buildx-action@v1
27 - name: Build and export to Docker
28 uses: docker/build-push-action@v2
31 file: ${{ matrix.base_os }}/Dockerfile
33 tags: ${{ env.TEST_TAG }}
36 docker run -it --rm ${{ env.TEST_TAG }} 'nix-channel --list'
37 docker run -it --rm ${{ env.TEST_TAG }} 'nix-env -iA nixpkgs.hello && test "$(hello)" = "Hello, world!"'
38 - name: Get the version
39 if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
41 run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
42 - name: Login to DockerHub
43 if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
44 uses: docker/login-action@v1
46 username: ${{ secrets.DOCKERHUB_USERNAME }}
47 password: ${{ secrets.DOCKERHUB_TOKEN }}
48 - name: Build and push
49 if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
51 uses: docker/build-push-action@v2
55 file: ${{ matrix.base_os }}/Dockerfile
56 tags: fretlink/nix:${{ steps.get_version.outputs.VERSION }}-${{ matrix.base_os }}