diff --git a/.forgejo/actions/push_container/action.yml b/.forgejo/actions/push_container/action.yml index 5ef7ae4..770d934 100644 --- a/.forgejo/actions/push_container/action.yml +++ b/.forgejo/actions/push_container/action.yml @@ -8,6 +8,10 @@ description: Push the `source` image to the `destination` registry # Parameters #======================================================================= inputs: + registry: + required: true + description: The registry to authen + source: required: true description: The source image to be pushed @@ -25,4 +29,10 @@ runs: - name: Authenticate run: | echo "Authenticate" - echo "pushing image '${{ inputs.source }}' to '${{ inputs.destination }}'" \ No newline at end of file + echo "pushing image '${{ inputs.source }}' to '${{ inputs.destination }}'" + + echo "${{ forge.token }}" | podman login --username '${{ forge.actor }}' --password-stdin + + - name: Push + run: | + podman push '${{ inputs.source }}' '${{ inputs.destination }}' \ No newline at end of file diff --git a/.forgejo/actions/push_container/push.sh b/.forgejo/actions/push_container/push.sh deleted file mode 100644 index e69de29..0000000 diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 0c04888..80b9073 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -35,30 +35,27 @@ jobs: run: | nix-build src/default.nix podman load < result + + - name: Log into registry + run: | + podman login \ + --log-level=debug \ + --authfile ~/.config/containers/auth.json \ + --username "${{ forge.actor }}" \ + --password "${{ forge.token }}" \ + ${{ env.registry }} - - uses: ./.forgejo/actions/push_container - with: - source: ${{ env.registry }}/${{ env.owner }}/${{ env.image }}:${{ env.tag }} - destination: ${{ env.registry }}/${{ env.owner }}/${{ env.image }}:${{ env.tag }} + curl --fail -u${{ forge.actor }}:${{ forge.token }} -sS ${{ env.registry }}/v2/token | jq --raw-output '"Authorization: token \(.token)"' - # - name: Log into registry - # run: >- - # podman login - # --log-level=debug - # --authfile ~/.config/containers/auth.json - # --username "${{ forge.actor }}" - # --password "${{ forge.token }}" - # ${{ env.registry }} + - name: __DEBUG__ + run: | + echo "~/.config/containers/auth.json" + [ -f ~/.config/containers/auth.json ] && cat ~/.config/containers/auth.json || echo "file doesn't exist" - # - name: __DEBUG__ - # run: | - # echo "~/.config/containers/auth.json" - # [ -f ~/.config/containers/auth.json ] && cat ~/.config/containers/auth.json || echo "file doesn't exist" - - # - 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 }} + - 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 }} diff --git a/src/default.nix b/src/default.nix index e5f56f9..608cc69 100644 --- a/src/default.nix +++ b/src/default.nix @@ -5,7 +5,7 @@ with pkgs; dockerTools.buildImage { - name = "git.amarth.cloud/default"; + name = "default"; tag = "latest"; copyToRoot = buildEnv {