chore: Enhance release workflow (#1400)

* Rename package-release to release

* Move tarball creation in Makefile

* Enhance release workflow

* Add --ignore-platform-reqs to composer build
This commit is contained in:
Jonas L 2021-10-15 14:59:59 +02:00 committed by GitHub
parent 8411c6225f
commit 4335795c52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 74 deletions

View File

@ -1,58 +0,0 @@
#!/usr/bin/env 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
else
suffix=$1-$2
fi
echo "Creating tarball for LibreTime ${suffix}."
echo -n "Creating VERSION file for ${suffix}..."
echo -n "${suffix}" > ./VERSION
echo " Done"
echo -n "Running composer install..."
pushd legacy || (echo "could not cd in legacy!" && exit 1)
composer install --quiet --no-dev --ignore-platform-reqs
popd || exit
echo " Done"
# Adding back; may be useful later...
#echo "Minimizing LibreTime Javascript files..."
#cd $dir
#find $target/legacy/public/js/airtime/ -iname "*.js" -exec bash -c 'echo {}; jsmin/jsmin < {} > {}.min' \;
#find $target/legacy/public/js/airtime/ -iname "*.js" -exec mv {}.min {} \;
#echo "Done"
cd ..
find "libretime-${suffix}" -type f -exec dos2unix {} \;
echo -n "Creating tarball..."
tar -czf "libretime-${suffix}.tar.gz" \
--owner=root --group=root \
--exclude-vcs \
--exclude .zfproject.xml \
--exclude .gitignore \
--exclude .gitattributes \
--exclude .travis.yml \
--exclude travis \
--exclude dev_tools \
--exclude legacy/vendor/phing \
--exclude legacy/vendor/simplepie/simplepie/tests \
libretime
echo " Done"

View File

@ -1,25 +1,26 @@
name: Create Release .tar.gz
name: Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
# MAJ.MIN.BUG version with an optional -TYPE.VER (for example 3.0.0-alpha.8)
- '\d+.\d+.\d+(-\w+\.\d+)*'
workflow_dispatch:
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-18.04
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Read file contents
id: release_notes_file
uses: andstor/file-reader-action@v1
with:
path: ./.github/RELEASE.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
@ -31,18 +32,17 @@ jobs:
body: ${ steps.release_notes_file.outputs.contents }
draft: true
prerelease: true
- name: Build project
run: |-
sudo apt update -y -q
sudo apt install dos2unix php composer -y
./.github/scripts/release.sh ${{ github.ref }}
- name: Build tarball
run: make tarball
- 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
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: libretime-${{ github.ref }}.tar.gz
asset_name: libretime-${{ github.ref }}.tar.gz
asset_content_type: application/tgz

View File

@ -17,3 +17,19 @@ shell-check:
VERSION:
tools/version.sh
.PHONY: tarball
tarball: VERSION
$(MAKE) -C legacy build
cd .. && tar -czf libretime-$(shell cat VERSION | tr -d [:blank:]).tar.gz \
--owner=root --group=root \
--exclude-vcs \
--exclude .codespellignore \
--exclude .git* \
--exclude .pre-commit-config.yaml \
--exclude dev_tools \
--exclude jekyll.sh \
--exclude legacy/vendor/phing \
--exclude legacy/vendor/simplepie/simplepie/tests \
libretime
mv ../libretime-*.tar.gz .

View File

@ -30,4 +30,4 @@ lint: $(PHP-CS-FIXER)
.PHONY: build
build:
COMPOSER_ARGS=--no-dev $(MAKE)
COMPOSER_ARGS="--no-dev --ignore-platform-reqs" $(MAKE)