runners/.forgejo/workflows/build.yml
Chris Kruining ae6f0a6065
Some checks failed
Create OCI image(s) / Build and push images (push) Failing after 1m51s
.
2025-09-08 13:11:30 +02:00

57 lines
1.6 KiB
YAML

name: Create OCI image(s)
on:
workflow_dispatch:
push:
branches:
- main
env:
registry: git.amarth.cloud
owner: amarth
image: default
tag: latest
jobs:
build:
name: Build and push images
runs-on: default
steps:
- name: Install dependencies
run: |
# configure container policy to accept insecure registry
nix-env -iA nixpkgs.nodejs nixpkgs.podman nixpkgs.kvmtool nixpkgs.curl nixpkgs.jq
# configure container policy to accept insecure registry
mkdir -p ~/.config/containers
echo '{ "default": [ {"type":"insecureAcceptAnything"} ] }' > ~/.config/containers/policy.json
- uses: actions/checkout@v4
- name: Log into registry
run: |
podman login \
--authfile ~/.config/containers/auth.json \
--username "${{ forge.actor }}" \
--password "${{ forge.token }}" \
${{ env.registry }}
curl --fail -u${{ forge.actor }}:${{ forge.token }} -sS ${{ env.registry }}/v2/token | jq --raw-output '"Authorization: token \(.token)"'
- name: __DEBUG__
run: |
echo "~/.config/containers/auth.json"
[ -f ~/.config/containers/auth.json ] && cat ~/.config/containers/auth.json || echo "file doesn't exist"
- name: Create image
run: |
nix-build src/default.nix
podman load < result
- name: Push image
run: >-
podman push
--log-level=debug
--authfile ~/.config/containers/auth.json
localhost/default:latest
${{ env.registry }}/${{ env.owner }}/${{ env.image }}:${{ env.tag }}