add dokcerhub description action
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
By default, Gitea runner environments do not include the dependencies required by (dockerhub-description)https://github.com/peter-evans/dockerhub-description
|
||||
This action is a wrapper around `dockerhub-description` that installs the required dependencies before invoking the upstream action, allowing it to run successfully on Gitea runners.
|
||||
|
||||
The wrapper then invokes the upstream action using the same inputs, making it a drop-in replacement.
|
||||
|
||||
usage:
|
||||
|
||||
```yaml
|
||||
uses: https://git.claeyscloud.com/david/gitea-actions/dockerhub-description@main
|
||||
with:
|
||||
username: username
|
||||
password: password
|
||||
repository: repo
|
||||
```
|
||||
@@ -0,0 +1,65 @@
|
||||
name: Docker Hub Description
|
||||
|
||||
description: |
|
||||
A wrapper around dockerhub-description that includes dependencies needed to run it on Gitea runners.
|
||||
|
||||
Upstream project:
|
||||
https://github.com/peter-evans/dockerhub-description
|
||||
|
||||
inputs:
|
||||
|
||||
username:
|
||||
description: |
|
||||
Docker Hub username.
|
||||
If updating a Docker Hub repository belonging to an organization, this user must have Admin permissions for the repository.
|
||||
required: true
|
||||
|
||||
password:
|
||||
required: true
|
||||
description: Docker Hub password or Personal Access Token with read/write/delete scope.
|
||||
|
||||
repository:
|
||||
required: true
|
||||
description: Docker Hub repository in the format <namespace>/<name>
|
||||
|
||||
short-description:
|
||||
required: false
|
||||
description: Docker Hub repository short description.
|
||||
|
||||
readme-filepath:
|
||||
required: false
|
||||
description: Path to the repository readme.
|
||||
default: "./README.md"
|
||||
|
||||
enable-url-completion:
|
||||
required: false
|
||||
description: Enables completion of relative URLs to absolute ones.
|
||||
default: "false"
|
||||
image-extensions:
|
||||
required: false
|
||||
description: File extensions that will be treated as images.
|
||||
default: "bmp,gif,jpg,jpeg,png,svg,webp"
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
|
||||
- name: Install Node dependencies
|
||||
shell: bash
|
||||
env:
|
||||
SCRIPT_NAME: install_dependencies.sh
|
||||
run: |
|
||||
chmod +x "${{ github.action_path }}/${SCRIPT_NAME}"
|
||||
"${{ github.action_path }}/${SCRIPT_NAME}"
|
||||
|
||||
- name: Update DockerHub Description
|
||||
uses: dockerhub-description-action/peter-evans/dockerhub-description@v5
|
||||
with:
|
||||
username: ${{ inputs.username }}
|
||||
password: ${{ inputs.password }}
|
||||
repository: ${{ inputs.repository }}
|
||||
short-description: ${{ inputs.short-description }}
|
||||
readme-filepath: ${{ inputs.readme-filepath }}
|
||||
enable-url-completion: ${{ inputs.enable-url-completion }}
|
||||
image-extensions: ${{ inputs.image-extensions }}
|
||||
@@ -0,0 +1,53 @@
|
||||
echo "Installing fetch"
|
||||
install_node=$false
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "No version of NodeJS detected"
|
||||
install_node=true
|
||||
else
|
||||
node_version=$(node -v)
|
||||
node_version=${node_version:1} # Remove 'v' at the beginning
|
||||
node_version=${node_version%\.*} # Remove trailing ".*".
|
||||
node_version=${node_version%\.*} # Remove trailing ".*".
|
||||
node_version=$(($node_version)) # Convert the NodeJS version number from a string to an integer.
|
||||
if [ $node_version -lt 24 ]; then
|
||||
echo "node version : " $node_version
|
||||
echo $"removing outdated npm version"
|
||||
install_node=true
|
||||
apt-get remove nodejs npm
|
||||
apt-get purge nodejs
|
||||
rm -rf /usr/local/bin/npm
|
||||
rm -rf /usr/local/share/man/man1/node*
|
||||
rm -rf /usr/local/lib/dtrace/node.d
|
||||
rm -rf ~/.npm
|
||||
rm -rf ~/.node-gyp
|
||||
rm -rf /opt/local/bin/node
|
||||
rm -rf opt/local/include/node
|
||||
rm -rf /opt/local/lib/node_modules
|
||||
rm -rf /usr/local/lib/node*
|
||||
rm -rf /usr/local/include/node*
|
||||
rm -rf /usr/local/bin/node*
|
||||
fi
|
||||
|
||||
if $install_node; then
|
||||
NODE_MAJOR=24
|
||||
echo "Installing node ${NODE_MAJOR}"
|
||||
if test -f /etc/apt/keyrings/nodesource.gpg; then
|
||||
rm /etc/apt/keyrings/nodesource.gpg
|
||||
fi
|
||||
if test -f /etc/apt/sources.list.d/nodesource.list; then
|
||||
rm /etc/apt/sources.list.d/nodesource.list
|
||||
fi
|
||||
apt-get update
|
||||
apt-get install -y -q ca-certificates curl gnupg
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
||||
apt-get update
|
||||
apt-get install -y -q nodejs
|
||||
npm install npm --global
|
||||
|
||||
echo "node version : " $(node -v)
|
||||
package='node-fetch'
|
||||
if [ `npm list -g | grep -c $package` -eq 0 ]; then
|
||||
npm install -g $package
|
||||
fi
|
||||
Reference in New Issue
Block a user