Automating packaging take 1 #v.0.1

This commit is contained in:
Zachary Klosko 2020-12-01 14:13:45 -05:00
parent 77ae02cf97
commit dbbc666a8d
2 changed files with 89 additions and 0 deletions

48
.github/scripts/package-release.sh vendored Normal file
View File

@ -0,0 +1,48 @@
#/bin/bash
#release.sh 1.8.2
#creates a libretime folder with a "1.8.2" suffix
#creates tarballs with a "1.8.2" suffix
#release.sh 1.8.2 RC
#creates a libretime folder with a "1.8.2-RC" suffix
#creates tarballs with a "1.8.2-RC" suffix
#release.sh 1.8.2-RC
#creates a libretime folder with a "1.8.2-RC" suffix
#creates tarballs with a "1.8.2-RC" suffix
if [ $# == 0 ]; then
echo "Zero arguments"
exit 1
elif [ $# == 1 ]; then
suffix=$1
version=$1
else
suffix=$1-$2
version=$1
fi
# Adding dos2unix package
apt update -y -q
apt install dos2unix -y
echo "Creating tarball for LibreTime ${suffix}."
target_file=libretime-${suffix}.tar.gz
echo -n "Running composer install..."
composer install --quiet --no-dev --ignore-platform-reqs
echo " Done"
find libretime-${suffix} -type f -exec dos2unix {} \;
echo -n "Creating tarball..."
tar -czf $target_file \
--owner=root --group=root \
--exclude-vcs \
--exclude .zfproject.xml \
--exclude .gitignore \
--exclude .gitattributes \
--exclude dev_tools \
libretime-${suffix}
echo " Done"

41
.github/workflows/package-release.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Create Release .tar.gz
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes
- 1
- 2
draft: false
prerelease: false
- name: Build project # This would actually build your project
run: sudo bash ./.github/scripts/package-release.sh ${{ github.ref }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./libretime-${{ github.ref }}.tar.gz
asset_name: libretime-${{ github.ref }}.tar.gz
asset_content_type: application/tgz