-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3f03b3
commit 10ddbfc
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: | ||
push: | ||
tags: | ||
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
name: Upload Release Asset | ||
jobs: | ||
build: | ||
name: Upload Release Asset # Name of the job | ||
runs-on: ubuntu-latest # or windows-latest, macOS-latest | ||
steps: | ||
- name: Setup PHP Action | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.2' | ||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} # Extract the version number from the tag | ||
- name: Checkout code | ||
uses: actions/checkout@v2 # Checkout the code | ||
- name: Build project | ||
run: ./bin/release.sh ${{ steps.get_version.outputs.VERSION }} # Build the project | ||
- name: Upload Release Asset | ||
run: | | ||
set -x | ||
assets=() | ||
for asset in ./.dist/*.zip; do | ||
assets+=("-a" "$asset") | ||
done | ||
tag_name="${GITHUB_REF##*/}" | ||
hub release create "${assets[@]}" -m "Release $tag_name" "$tag_name" -d | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.env | ||
/.idea | ||
/cscart | ||
.dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit if any command fails | ||
set -eo pipefail | ||
|
||
RELEASE_VERSION=$1 | ||
FILENAME_PREFIX="Plugin_CS-Cart_" | ||
RELEASE_FOLDER=".dist" | ||
FOLDER_PREFIX="plugin" | ||
|
||
# If tag is not supplied, latest tag is used | ||
if [ -z "$RELEASE_VERSION" ] | ||
then | ||
RELEASE_VERSION=$(git describe --tags --abbrev=0) | ||
fi | ||
|
||
# Remove the old release folder | ||
rm -rf "$RELEASE_FOLDER" && | ||
|
||
# Create release from .git | ||
mkdir "$RELEASE_FOLDER" && | ||
git archive --format zip -9 --prefix="$FOLDER_PREFIX"/ --output "$RELEASE_FOLDER"/"$FILENAME_PREFIX""$RELEASE_VERSION".zip "$RELEASE_VERSION" && | ||
|
||
# Unzip to manipulate the files | ||
cd "$RELEASE_FOLDER" && | ||
unzip "$FILENAME_PREFIX""$RELEASE_VERSION".zip && | ||
|
||
# Remove zip file. | ||
rm "$FILENAME_PREFIX""$RELEASE_VERSION".zip | ||
|
||
# Change to the extension folder | ||
cd "$FOLDER_PREFIX" && | ||
|
||
# Zip everything excluding some specific files | ||
zip -9 -r "$FILENAME_PREFIX""$RELEASE_VERSION".zip ./src/* && | ||
|
||
# Move the zip file to the root of the release folder | ||
mv "$FILENAME_PREFIX""$RELEASE_VERSION".zip ../ && | ||
|
||
# Remove the temporal directory to build the release | ||
cd ../ && | ||
rm -rf "$FOLDER_PREFIX" |
File renamed without changes.