-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollect-assets
executable file
·36 lines (30 loc) · 1.17 KB
/
collect-assets
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
#!/usr/bin/env bash
# Copyright (c) 2022, Manticore Software LTD (https://manticoreseAPP_ARCH.com)
# This program is free software; you can redistribute it and/or modify
# it under the terms of the The PHP License, version 3.01. You should have
# received a copy of the license along with this program; if you did not,
# you can find it at https://www.php.net/license/3_01.txt
# ! Must be defined: APP_ARCH, APP_NAME, APP_VERSION, GITHUB_SHA, RUNNER_OS
# This script is part of tools to use in GitHub workflow
current_date=$( date +%y%m%d )
APP_DATE=${APP_DATE:-$current_date}
assets="${APP_NAME}_${APP_VERSION}-${APP_DATE}-${GITHUB_SHA:0:7}_$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')_${APP_ARCH}${ASSET_SUFFIX}"
pwd
echo "$assets"
mkdir -p "$assets"
# If we have dist dir that means we built it on host machine
if test -d build/dist; then
cp build/dist/bin/php "$assets/${APP_NAME}"
else
id=$(docker create "${DOCKER_IMAGE}")
docker cp "$id:/usr/bin/${APP_NAME}" "$assets/${APP_NAME}"
chmod +x "$assets/${APP_NAME}"
docker rm -v "$id"
fi
# Add common files
cp {README.md,LICENSE} "$assets/"
# Finaly make assets arhive
(
tar czf "$assets.tar.gz" "$assets"
ls -lah *.*
)