49 lines
1.7 KiB
YAML
49 lines
1.7 KiB
YAML
name: niks3 Upload
|
|
description: Upload paths to a binary cache
|
|
|
|
inputs:
|
|
server-url:
|
|
description: niks3 Server URL
|
|
default: https://niks3.tami.moe
|
|
required: false
|
|
token:
|
|
description: The api token in niks3
|
|
required: true
|
|
pin:
|
|
description: >
|
|
Whether to pin $(readlink result), if true then uses default name, if a string it uses that name
|
|
default: "false"
|
|
required: false
|
|
|
|
# enable-openid-connect: true
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: setup authentication
|
|
run: |
|
|
# echo "url is: $ACTIONS_ID_TOKEN_REQUEST_URL"
|
|
# curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://niks3.tami.moe" > /run/niks3-auth-token
|
|
export NIKS3_AUTH_TOKEN_FILE=$(mktemp)
|
|
printf '%s' "$TOKEN" > "$NIKS3_AUTH_TOKEN_FILE"
|
|
|
|
echo "set up environment for niks3"
|
|
NIKS3_REPO_NAME=$(echo "$FORGEJO_REPOSITORY" | sed 's/[^[:alnum:]_-]/./g')
|
|
echo "NIKS3_AUTH_TOKEN_FILE=$NIKS3_AUTH_TOKEN_FILE" >> "$FORGEJO_ENV"
|
|
echo "NIKS3_SERVER_URL=$NIKS3_SERVER_URL" >> "$FORGEJO_ENV"
|
|
echo "NIKS3_REPO_NAME=CI.$NIKS3_REPO_NAME" >> "$FORGEJO_ENV"
|
|
env:
|
|
NIKS3_SERVER_URL: ${{ inputs.server-url }}
|
|
TOKEN: ${{ inputs.token }}
|
|
- name: upload artifact with custom name
|
|
if: inputs.pin != 'false'
|
|
run: |
|
|
if [ "$PIN" = "true" ]; then
|
|
echo "pinning with default name"
|
|
niks3 push --pin "$NIKS3_REPO_NAME" "$(realpath result)"
|
|
else
|
|
echo "pinning with default name plus pin string"
|
|
niks3 push --pin "$NIKS3_REPO_NAME.$PIN" "$(realpath result)"
|
|
fi
|
|
env:
|
|
PIN: ${{ inputs.pin }}
|