62 lines
1.7 KiB
YAML
62 lines
1.7 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: |
|
|
nix-env -iA nixpkgs.nodejs nixpkgs.podman nixpkgs.kvmtool
|
|
|
|
# cheatsheet: https://nexveridian.com/blog/forgejo-pushing-container-images/
|
|
- name: Prepare environment
|
|
run: |
|
|
mkdir -p ~/.config/containers
|
|
# configure container policy to accept insecure registry
|
|
echo "Creating config file..."
|
|
echo '{ "default": [ {"type":"insecureAcceptAnything"} ] }' > ~/.config/containers/policy.json
|
|
echo "Created config file"
|
|
|
|
# configure authentication
|
|
# echo "Creating auth file..."
|
|
# cat > ~/.config/containers/auth.json <<EOF
|
|
# {
|
|
# "auths": {
|
|
# "${{ env.registry }}": {
|
|
# "auth": "$(echo -n "${{ forge.actor }}:${{ secrets.PACKAGE_TOKEN }}" | base64 -w 0)"
|
|
# }
|
|
# }
|
|
# }
|
|
# EOF
|
|
# echo "Created auth file"
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Authenticate
|
|
run: |
|
|
podman login --username '${{ forge.actor }}' --password '${{ secrets.PACKAGE_TOKEN }}'
|
|
|
|
- name: Create image
|
|
run: |
|
|
nix-build src/${{ env.image }}.nix
|
|
podman load < result
|
|
|
|
- name: Push image
|
|
run: >-
|
|
podman push
|
|
localhost/${{ env.image }}:${{ env.tag }}
|
|
${{ env.registry }}/${{ forge.repository }}/${{ env.image }}:${{ env.tag }}
|