koel/.github/workflows/release.yml

73 lines
2.7 KiB
YAML

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Upload Release Assets
jobs:
build:
name: Upload Release Assets
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
extensions: pdo_sqlite, zip, gd
- name: Install PHP dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--prefer-dist --no-dev"
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Build project
run: |
sudo apt install pngquant zip unzip
sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env
php artisan koel:init --no-interaction
- name: Create archives
run: |
sed -i 's/DB_CONNECTION=sqlite/DB_CONNECTION=sqlite-persistent/' .env
sed -i 's/DB_DATABASE=koel/DB_DATABASE=koel.db/' .env
rm -rf .git ./node_modules ./storage/search-indexes/*.index ./koel.db ./.env
cd ../
zip -r /tmp/koel-${{ steps.get_version.outputs.VERSION }}.zip koel/
tar -zcf /tmp/koel-${{ steps.get_version.outputs.VERSION }}.tar.gz koel/
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
draft: true
prerelease: false
- name: Upload release asset zip
id: upload-release-asset-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/koel-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: koel-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
- name: Upload release asset gzip
id: upload-release-asset-gzip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/koel-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_name: koel-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_content_type: application/gzip