koel/.github/workflows/release.yml

74 lines
2.7 KiB
YAML
Raw Normal View History

2020-07-15 13:20:02 +00:00
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
2020-07-15 13:20:02 +00:00
2021-12-30 19:09:41 +00:00
name: Upload Release Assets
2020-07-15 13:20:02 +00:00
jobs:
build:
2021-12-30 19:09:41 +00:00
name: Upload Release Assets
2020-07-15 13:20:02 +00:00
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
2021-12-30 19:09:41 +00:00
- uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
2021-12-30 19:09:41 +00:00
tools: composer:v2
extensions: pdo_sqlite, zip, gd
2021-12-30 19:09:41 +00:00
- name: Install PHP dependencies
uses: ramsey/composer-install@v2
2021-12-30 19:09:41 +00:00
with:
2022-10-23 09:16:20 +00:00
composer-options: "--prefer-dist --no-dev"
2021-12-30 19:09:41 +00:00
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 18
2021-12-30 19:09:41 +00:00
- name: Build project
2020-07-15 13:20:02 +00:00
run: |
2021-12-30 19:09:41 +00:00
sudo apt install pngquant zip unzip
2020-07-15 13:20:02 +00:00
sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env
php artisan koel:init --no-interaction
2021-12-30 19:09:41 +00:00
- name: Create archives
run: |
2020-07-15 13:20:02 +00:00
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
2020-07-15 13:20:02 +00:00
cd ../
zip -r /tmp/koel-${{ steps.get_version.outputs.VERSION }}.zip koel/
tar -zcf /tmp/koel-${{ steps.get_version.outputs.VERSION }}.tar.gz koel/
2021-12-30 19:09:41 +00:00
- name: Create release
2020-07-15 13:20:02 +00:00
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
2021-01-18 19:10:44 +00:00
release_name: ${{ steps.get_version.outputs.VERSION }}
2020-07-15 13:20:02 +00:00
draft: true
prerelease: false
2021-12-30 19:09:41 +00:00
- name: Upload release asset zip
2020-07-15 13:20:02 +00:00
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 }}
2020-07-15 13:20:02 +00:00
asset_path: /tmp/koel-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: koel-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
2021-12-30 19:09:41 +00:00
- name: Upload release asset gzip
2020-07-15 13:20:02 +00:00
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 }}
2020-07-15 13:20:02 +00:00
asset_path: /tmp/koel-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_name: koel-${{ steps.get_version.outputs.VERSION }}.tar.gz
2021-01-18 19:10:44 +00:00
asset_content_type: application/gzip