nixos-runner/.github/workflows/build.yaml

42 lines
1.6 KiB
YAML
Raw Normal View History

2023-04-15 19:15:39 -05:00
name: build nixos-runner
on:
- push
jobs:
build:
runs-on: ubuntu-latest
2023-04-15 23:08:34 -05:00
container: docker.io/jcollie/nixos-runner:latest
2023-08-17 12:25:07 -05:00
env:
REGISTRY: ghcr.io
REPOSITORY: jcollie/nixos-runner
2023-04-15 19:15:39 -05:00
steps:
2023-04-15 22:17:03 -05:00
- uses: actions/checkout@v3
2023-08-17 12:25:07 -05:00
- run: set
- run: nix build -L .#nixos-runner
2023-08-17 12:39:22 -05:00
# - uses: redhat-actions/podman-login@v1
# with:
# registry: ghcr.io/${{ github.repository_owner }}
# username: ${{ github.actor }}
# password: ${{ github.token }}
- run: echo -n "${PASSWORD}" | podman login --username ${USERNAME} --password-stdin ${REPOSITORY}
2023-04-16 00:33:48 -05:00
env:
2023-08-17 12:39:22 -05:00
REPOSITORY: ghcr.io/${{ github.repository_owner }}
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
2023-08-17 12:25:07 -05:00
- run: podman load --input result | sed -n -e "s/Loaded image:.\\(.*\\)/loaded-image=\\1/p" >> $GITHUB_OUTPUT
id: podman-load-image
- run: podman images
- run: podman tag "${IMAGE}" "${REGISTRY}/${REPOSITORY}:${GITHUB_RUN_NUMBER}-${GITHUB_SHA:0:8}"
env:
IMAGE: ${{ steps.podman-load-image.outputs.loaded-image }}
- run: podman tag "${IMAGE}" "${REGISTRY}/${REPOSITORY}:latest"
env:
IMAGE: ${{ steps.podman-load-image.outputs.loaded-image }}
- run: podman images
- run: podman push "${REGISTRY}/${REPOSITORY}:${GITHUB_RUN_NUMBER}-${GITHUB_SHA:0:8}"
- run: podman push "${REGISTRY}/${REPOSITORY}:latest"
- run: podman logout "${REGISTRY}"
# - run: nix run .#push-container -- result --registry ghcr.io --repository jcollie/nixos-runner
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}