mirror of
https://github.com/torrentpier/torrentpier.git
synced 2025-03-12 04:35:42 -07:00
* misc: Created cleanup script (for releases preparation) * Update _cleanup.php * Update _cleanup.php * Update _cleanup.php
81 lines
2.3 KiB
YAML
81 lines
2.3 KiB
YAML
name: Continuous Deployment
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
jobs:
|
|
generate-changelog:
|
|
name: Generate changelog
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
release_body: ${{ steps.git-cliff.outputs.content }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate a changelog
|
|
uses: orhun/git-cliff-action@v4
|
|
id: git-cliff
|
|
with:
|
|
config: cliff-releases.toml
|
|
args: -vv --latest --no-exec --github-repo ${{ github.repository }}
|
|
|
|
- name: Print the changelog
|
|
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
|
|
|
release:
|
|
name: Create release
|
|
needs: [ generate-changelog ]
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set the release version
|
|
shell: bash
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.1'
|
|
|
|
- name: Install Composer dependencies
|
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
|
|
|
- name: Cleanup
|
|
run: php _cleanup.php && rm _cleanup.php
|
|
|
|
- name: Create archive
|
|
id: create-zip
|
|
run: |
|
|
ZIP_NAME="torrentpier-v${{ env.RELEASE_VERSION }}.zip"
|
|
zip -r "$ZIP_NAME" . -x ".git/*"
|
|
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
|
|
|
- name: Publish to GitHub
|
|
if: ${{ !contains(github.ref, '-') }}
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: ${{ steps.create-zip.outputs.ZIP_NAME }}
|
|
overwrite: true
|
|
tag: ${{ github.ref }}
|
|
release_name: "v${{ env.RELEASE_VERSION }}"
|
|
body: "${{ needs.generate-changelog.outputs.release_body }}"
|
|
|
|
- name: Publish to GitHub (pre-release)
|
|
if: ${{ contains(github.ref, '-') }}
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: ${{ steps.create-zip.outputs.ZIP_NAME }}
|
|
overwrite: true
|
|
tag: ${{ github.ref }}
|
|
release_name: "v${{ env.RELEASE_VERSION }}"
|
|
body: "${{ needs.generate-changelog.outputs.release_body }}"
|
|
prerelease: true
|