on: push: # Sequence of patterns matched against refs/tags tags: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 name: Upload Release Asset jobs: build: name: Upload Release Asset runs-on: ubuntu-latest steps: - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - name: Checkout code uses: actions/checkout@v2 - name: Build project # This would actually build your project, using zip for an example artifact run: | sudo apt install php7.4 composer php7.4-sqlite3 php7.4-intl php7.4-gd pngquant zip unzip git submodule update --init --recursive composer install --no-dev -o sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env php artisan koel:init --no-interaction 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 ./resources/assets/.git ./resources/assets/node_modules ./storage/search-indexes/*.index ./koel.db ./.env cd ../ zip -r /tmp/koel-${{ steps.get_version.outputs.VERSION }}.zip koel/ tar -zcvf /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 }} # This pulls from the CREATE RELEASE step above, referencing its 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: /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 }} # This pulls from the CREATE RELEASE step above, referencing its 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: /tmp/koel-${{ steps.get_version.outputs.VERSION }}.tar.gz asset_name: koel-${{ steps.get_version.outputs.VERSION }}.tar.gz asset_content_type: application/gzip