summaryrefslogtreecommitdiff
path: root/act/run-act.sh
blob: 8060d86220d68ced2b11759b45ce4b0d51dd2976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

type=$1
# bump=$2

oldartifactsdir="old"

parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$parent_path"

artifactfolders=$(find artifacts/ -maxdepth 1 -mindepth 1 -type d)
if [[ ${#artifactfolders[@]} > 0 ]]; then
    for i in ${artifactfolders[@]}; do
        foldername=$(dirname $i)
        subfoldername=$(basename $i)
        out=$foldername/$oldartifactsdir/$subfoldername-$(date +'%s')
        if [[ ! "$subfoldername" =~ "$oldartifactsdir" ]]; then
            mkdir -p $out
            mv $i $out
            printf "Moved "${foldername}"/"${subfoldername}" to "${out}" \n"
        fi
    done
fi

cd ..

if [[ "$type" == "release" ]]; then
    printf "release!\n"
    act workflow_dispatch -e act/release.json --artifact-server-path act/artifacts --container-architecture linux/amd64
elif [[ "$type" == "prerelease" ]]; then
    printf "prerelease!\n"
    act workflow_dispatch -e act/prerelease.json --artifact-server-path act/artifacts --container-architecture linux/amd64
else
    printf "Release type unspecified/badly specified.\n"
    printf "Options: 'release' or 'prerelease'\n"
fi

cd act/artifacts

if [[ -d "1" ]]; then
    cd "1/artifact"
    cp "PluginLoader.gz__" "PluginLoader.gz"
    gzip -d "PluginLoader.gz"
    chmod +x PluginLoader
fi