initial commit
This commit is contained in:
7
distros/busybox/Dockerfile
Normal file
7
distros/busybox/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
# Container image that runs your code
|
||||
FROM busybox:1.36.0
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
14
distros/busybox/action.yaml
Normal file
14
distros/busybox/action.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
name: busybox
|
||||
description: "Run busybox commands."
|
||||
inputs:
|
||||
args:
|
||||
description: "Shell arguments to pass into busybox."
|
||||
required: true
|
||||
outputs:
|
||||
console:
|
||||
description: "The console output of the command."
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
- ${{ inputs.args }}
|
||||
15
distros/busybox/entrypoint.sh
Normal file
15
distros/busybox/entrypoint.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
ARGS="$@"
|
||||
|
||||
OUTPUT=$(sh -c "$ARGS")
|
||||
RESULT=$?
|
||||
echo "$OUTPUT"
|
||||
|
||||
#Output multiline strings.
|
||||
#https://trstringer.com/github-actions-multiline-strings/
|
||||
OUTPUT="${OUTPUT//'%'/'%25'}"
|
||||
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
|
||||
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
|
||||
echo "::set-output name=console::$OUTPUT"
|
||||
|
||||
exit $RESULT
|
||||
18
distros/rockylinux2/Dockerfile
Normal file
18
distros/rockylinux2/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
# Container image that runs your code
|
||||
FROM rockylinux:9.1
|
||||
|
||||
RUN dnf install -y \
|
||||
rpm-sign \
|
||||
unzip \
|
||||
pinentry \
|
||||
wget \
|
||||
zip
|
||||
|
||||
COPY setup_gpg.sh /setup_gpg.sh
|
||||
RUN chmod +x /setup_gpg.sh
|
||||
RUN /setup_gpg.sh
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
19
distros/rockylinux2/action.yaml
Normal file
19
distros/rockylinux2/action.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: rockylinux
|
||||
description: "Run rockylinux commands."
|
||||
inputs:
|
||||
#args:
|
||||
# description: "Shell arguments to pass into Rocky Linux."
|
||||
# required: true
|
||||
workingDir:
|
||||
description: "Working directory to execute the commands in."
|
||||
required: true
|
||||
default: "."
|
||||
outputs:
|
||||
console:
|
||||
description: "The console output of the command."
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
#- "${{ inputs.workingDir }}"
|
||||
- "${{ inputs.args }}"
|
||||
18
distros/rockylinux2/entrypoint.sh
Normal file
18
distros/rockylinux2/entrypoint.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
WORKDIR="$1"
|
||||
cd "$WORKDIR"
|
||||
|
||||
ARGS_ARRAY=($@)
|
||||
ARGS=${array[@]:1}
|
||||
OUTPUT=$(bash -c "$ARGS")
|
||||
RESULT=$?
|
||||
echo "$OUTPUT"
|
||||
|
||||
#Output multiline strings.
|
||||
#https://trstringer.com/github-actions-multiline-strings/
|
||||
OUTPUT="${OUTPUT//'%'/'%25'}"
|
||||
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
|
||||
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
|
||||
echo "::set-output name=console::$OUTPUT"
|
||||
|
||||
exit $RESULT
|
||||
29
distros/rockylinux2/setup_gpg.sh
Normal file
29
distros/rockylinux2/setup_gpg.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
#Importing gpg key via cli
|
||||
#https://d.sb/2016/11/gpg-inappropriate-ioctl-for-device-errors
|
||||
GPG_CONF="$HOME/.gnupg/gpg.conf"
|
||||
GPG_AGENT_CONF="$HOME/.gnupg/gpg-agent.conf"
|
||||
|
||||
function create_file
|
||||
{
|
||||
FILE_PATH="$1"
|
||||
CONTENTS="$2"
|
||||
DIR=$(dirname "$FILE_PATH")
|
||||
|
||||
mkdir -p "$DIR"
|
||||
chmod 700 "$DIR"
|
||||
echo "$CONTENTS" > "$FILE_PATH"
|
||||
}
|
||||
|
||||
create_file "$GPG_CONF" "$(cat <<EOF
|
||||
use-agent
|
||||
pinentry-mode loopback
|
||||
EOF
|
||||
)"
|
||||
|
||||
create_file "$GPG_AGENT_CONF" "$(cat <<EOF
|
||||
allow-loopback-pinentry
|
||||
EOF
|
||||
)"
|
||||
|
||||
echo "RELOADAGENT" | gpg-connect-agent
|
||||
76
docker/docker-cp/action.yaml
Normal file
76
docker/docker-cp/action.yaml
Normal file
@@ -0,0 +1,76 @@
|
||||
name: docker-cp
|
||||
description: "Copy a file or folder to or from a docker container or volume."
|
||||
inputs:
|
||||
volume:
|
||||
description: "Name of the volume to copy to or from."
|
||||
required: true
|
||||
volumeMount:
|
||||
description: "Where to mount the volume in the container. Defaults to '/mnt'."
|
||||
required: true
|
||||
default: ""
|
||||
recreateVolume:
|
||||
description: "Delete the specified volume before creation if it exist."
|
||||
required: true
|
||||
default: "false"
|
||||
fromPath:
|
||||
description: "Path the copy from. 'volumeName:' in the path will be replaced with volumeMount. Defaults to root volume path."
|
||||
required: true
|
||||
toPath:
|
||||
description: "Path the copy to. 'volumeName:' in the path will be replaced with volumeMount. Defaults to root volume path."
|
||||
required: true
|
||||
default: ""
|
||||
containerName:
|
||||
description: "Name of the temporary docker container to create."
|
||||
required: true
|
||||
default: ${{ env.bamboo_buildResultKey || github.sha }}
|
||||
copyFlags:
|
||||
description: "Flags to use for docker cp. Use -a to copy permissions. Use -L to follow symbolic links."
|
||||
required: false
|
||||
default: ""
|
||||
image:
|
||||
description: "Docker image to run."
|
||||
required: true
|
||||
default: "busybox:latest"
|
||||
entrypoint:
|
||||
description: "Entrypoint of the docker image."
|
||||
required: false
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Copy Files"
|
||||
run: |
|
||||
DEFAULT_PATH="${{ inputs.volume }}:/"
|
||||
|
||||
FROM_PATH="${{ inputs.fromPath }}"
|
||||
if [[ -z "$FROM_PATH" ]]; then
|
||||
FROM_PATH="$DEFAULT_PATH"
|
||||
fi
|
||||
TO_PATH="${{ inputs.toPath }}"
|
||||
if [[ -z "$TO_PATH" ]]; then
|
||||
TO_PATH="$DEFAULT_PATH"
|
||||
fi
|
||||
|
||||
VOLUME_MOUNT="${{ inputs.volumeMount }}"
|
||||
if [[ -z "$VOLUME_MOUNT" ]]; then
|
||||
VOLUME_MOUNT="/mnt"
|
||||
fi
|
||||
|
||||
DEFAULT_REPLACEMENT="${{ inputs.containerName }}:$VOLUME_MOUNT"
|
||||
FROM_PATH=$(echo "$FROM_PATH" | sed "s|${{ inputs.volume }}:|$DEFAULT_REPLACEMENT|g")
|
||||
TO_PATH=$(echo "$TO_PATH" | sed "s|${{ inputs.volume }}:|$DEFAULT_REPLACEMENT|g")
|
||||
|
||||
# Delete the volume if it exists.
|
||||
if [[ "${{ inputs.recreateVolume }}" == "true" ]] && [[ $(docker volume ls --quiet | grep -w "^${{ inputs.volume }}$" | wc -l ) -gt 0 ]]; then
|
||||
docker volume rm "${{ inputs.volume }}" --force
|
||||
echo "Deleted volume: ${{ inputs.volume }}"
|
||||
fi
|
||||
|
||||
docker run --rm -d -i -v ${{ inputs.volume }}:$VOLUME_MOUNT --name ${{ inputs.containerName }} ${{ inputs.image }} ${{ inputs.entrypoint }}
|
||||
OUTPUT=$(docker cp ${{ inputs.copyFlags }} $FROM_PATH $TO_PATH 2>&1) && RESULT=$? || RESULT=$?
|
||||
echo "$OUTPUT"
|
||||
|
||||
echo "Removing Temporary Container"
|
||||
docker stop ${{ inputs.containerName }} -t 0
|
||||
|
||||
exit $RESULT
|
||||
shell: bash
|
||||
9
dotnet/Dockerfile
Normal file
9
dotnet/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0
|
||||
|
||||
# https://github.com/dotnet-script/dotnet-script
|
||||
#RUN dotnet tool install dotnet-script --tool-path /usr/bin
|
||||
|
||||
COPY ./startup.sh /startup.sh
|
||||
RUN chmod +x /startup.sh
|
||||
|
||||
ENTRYPOINT [ "/startup.sh" ]
|
||||
11
dotnet/action.yaml
Normal file
11
dotnet/action.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
name: "dotnet"
|
||||
description: "Runs the specified dotnet command."
|
||||
inputs:
|
||||
command:
|
||||
description: "The command to run."
|
||||
required: false
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
- ${{ inputs.command }}
|
||||
2
dotnet/startup.sh
Normal file
2
dotnet/startup.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
dotnet $@
|
||||
38
utils/chown/action.yaml
Normal file
38
utils/chown/action.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: chown
|
||||
description: "Take or change ownership of the specified files."
|
||||
inputs:
|
||||
uid:
|
||||
description: "User id."
|
||||
required: false
|
||||
default: ""
|
||||
gid:
|
||||
description: "Group id."
|
||||
required: false
|
||||
default: ""
|
||||
file:
|
||||
description: "File or folder to own."
|
||||
required: true
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Determine UID and GID."
|
||||
id: ids
|
||||
run: |
|
||||
USER_UID="${{ inputs.uid }}"
|
||||
USER_GID="${{ inputs.gid }}"
|
||||
if [[ -z "$USER_UID" ]]; then
|
||||
USER_UID=$(id -u)
|
||||
fi
|
||||
if [[ -z "$USER_GID" ]]; then
|
||||
USER_GID=$(id -g)
|
||||
fi
|
||||
|
||||
echo $USER_UID:$USER_GID
|
||||
|
||||
echo "::set-output name=uid::$USER_UID"
|
||||
echo "::set-output name=gid::$USER_GID"
|
||||
shell: bash
|
||||
- name: "Take ownership of output."
|
||||
uses: act/common/distros/busybox@master
|
||||
with:
|
||||
args: chown ${{ steps.ids.outputs.uid }}:${{ steps.ids.outputs.gid }} "${{ inputs.file }}" -R
|
||||
67
utils/compress/action.yaml
Normal file
67
utils/compress/action.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
name: compress
|
||||
description: "Compress a file or directory"
|
||||
inputs:
|
||||
files:
|
||||
description: "File or directory to compress."
|
||||
required: true
|
||||
name:
|
||||
description: "Filename of the zip file."
|
||||
required: true
|
||||
recursive:
|
||||
description: "Recursivly zip files. Default: true"
|
||||
required: false
|
||||
default: "true"
|
||||
quiet:
|
||||
description: "Don't output every zipped file. Default: true"
|
||||
required: false
|
||||
default: "true"
|
||||
compressionLevel:
|
||||
description: "Compression level between 1-9. Default: 6"
|
||||
required: false
|
||||
default: "6"
|
||||
compressionMethod:
|
||||
description: "Compression method. Options: deflate or store. Default: deflate"
|
||||
required: true
|
||||
default: "deflate"
|
||||
additionalArgs:
|
||||
description: "Additional arguments."
|
||||
required: false
|
||||
workingDir:
|
||||
description: "Working directory to perform the command in. Default: ."
|
||||
required: true
|
||||
default: "."
|
||||
outputs:
|
||||
publicKey:
|
||||
description: "The compressed archive."
|
||||
value: ${{ steps.command.outputs.name }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Build command."
|
||||
id: command
|
||||
run: |
|
||||
cd "${{ inputs.workingDir }}"
|
||||
mkdir -p "$(dirname '${{ inputs.name }}')"
|
||||
COMMAND="zip -${{ inputs.compressionLevel }} -Z ${{ inputs.compressionMethod }} ${{ inputs.additionalArgs }}"
|
||||
if [[ "${{ inputs.recursive }}" == "true" ]]; then
|
||||
COMMAND="$COMMAND -r"
|
||||
fi
|
||||
if [[ "${{ inputs.quiet }}" == "true" ]]; then
|
||||
COMMAND="$COMMAND -q"
|
||||
fi
|
||||
NAME="${{ inputs.name }}"
|
||||
NAME="${NAME/ /\\ }"
|
||||
FILES="${{ inputs.files }}"
|
||||
FILES="${FILES/ /\\ }"
|
||||
|
||||
COMMAND="$COMMAND $NAME $FILES"
|
||||
echo "Compressing with: $COMMAND"
|
||||
echo "::set-output name=command::$COMMAND"
|
||||
echo "::set-output name=name::${{ inputs.name }}"
|
||||
shell: bash
|
||||
- name: "Compress archive."
|
||||
id: compress
|
||||
uses: act/common/distros/rockylinux@master
|
||||
with:
|
||||
workingDir: ${{ inputs.workingDir }}
|
||||
args: ${{ steps.command.outputs.command }}
|
||||
30
utils/download/action.yaml
Normal file
30
utils/download/action.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
name: download
|
||||
description: "Download a file from a URL."
|
||||
inputs:
|
||||
url:
|
||||
description: "Url to download from."
|
||||
required: true
|
||||
outputFile:
|
||||
description: "Output file of the download."
|
||||
required: false
|
||||
default: ""
|
||||
outputs:
|
||||
file:
|
||||
description: "The path of the downloaded file."
|
||||
value: ${{ steps.download.outputs.file }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: cp -f ${{ github.action_path }}/download.sh _download.sh
|
||||
shell: bash
|
||||
- name: "Download file."
|
||||
id: download
|
||||
uses: act/common/distros/rockylinux@master
|
||||
with:
|
||||
args: sh "_download.sh" "${{ inputs.url }}" "${{ inputs.outputFile }}"
|
||||
- run: rm _download.sh
|
||||
shell: bash
|
||||
- name: "Own artifacts."
|
||||
uses: act/common/utils/chown@master
|
||||
with:
|
||||
file: ${{ steps.download.outputs.file }}
|
||||
8
utils/download/download.sh
Normal file
8
utils/download/download.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
URL="$1"
|
||||
OUTPUT_FILE="$2"
|
||||
if [[ -z "$OUTPUT_FILE" ]]; then
|
||||
OUTPUT_FILE="$(basename $URL)"
|
||||
fi
|
||||
wget $URL -O "$OUTPUT_FILE"
|
||||
echo "::set-output name=file::$OUTPUT_FILE"
|
||||
45
utils/extract/action.yaml
Normal file
45
utils/extract/action.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
name: extract
|
||||
description: "Extract a compressed file."
|
||||
inputs:
|
||||
file:
|
||||
description: "File to extract."
|
||||
required: true
|
||||
outputDir:
|
||||
description: "Directory to extract to."
|
||||
required: false
|
||||
default: ""
|
||||
prefixArgs:
|
||||
description: "Additional arguments to pass in early."
|
||||
required: false
|
||||
additionalArgs:
|
||||
description: "Additional arguments to pass in."
|
||||
required: false
|
||||
deleteSource:
|
||||
description: "Delete the compressed file afterwards."
|
||||
required: false
|
||||
default: "false"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Build command."
|
||||
id: command
|
||||
run: |
|
||||
COMMAND="unzip ${{ inputs.prefixArgs }} -o ${{ inputs.file }} ${{ inputs.additionalArgs }}"
|
||||
OUTPUT_DIR="${{ inputs.outputDir }}"
|
||||
if [[ -n "$OUTPUT_DIR" ]]; then
|
||||
COMMAND="$COMMAND" -d "$OUTPUT_DIR"
|
||||
fi
|
||||
echo "::set-output name=command::$COMMAND"
|
||||
shell: bash
|
||||
- name: "Convert file."
|
||||
id: convert
|
||||
uses: act/common/distros/busybox@master
|
||||
with:
|
||||
args: ${{ steps.command.outputs.command }}
|
||||
- name: "Delete source."
|
||||
run: |
|
||||
if [[ ${{ inputs.deleteSource }} != "true" ]]; then
|
||||
return
|
||||
fi
|
||||
rm ${{ inputs.file }}
|
||||
shell: bash
|
||||
Reference in New Issue
Block a user