mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
misc(workflow): Refactored all workflows (#1803)
* misc(workflow): Refactored all workflows * Update cd.yml
This commit is contained in:
parent
25a89b093d
commit
a29d57b2f8
5 changed files with 129 additions and 136 deletions
41
.github/workflows/build.yml
vendored
41
.github/workflows/build.yml
vendored
|
@ -1,41 +0,0 @@
|
||||||
name: TorrentPier nightly builder
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- 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: Get commit hash
|
|
||||||
id: get_commit_hash
|
|
||||||
run: |
|
|
||||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
|
||||||
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Create archive
|
|
||||||
id: create_zip
|
|
||||||
run: |
|
|
||||||
ZIP_NAME="torrentpier-${{ steps.get_commit_hash.outputs.COMMIT_HASH }}.zip"
|
|
||||||
zip -r "$ZIP_NAME" . -x ".git/*" ".github/*"
|
|
||||||
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Upload Archive
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: TorrentPier
|
|
||||||
path: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
|
71
.github/workflows/cd.yml
vendored
Normal file
71
.github/workflows/cd.yml
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
name: Continuous Deployment
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changelog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: master
|
||||||
|
token: ${{ secrets.REPO_TOKEN }}
|
||||||
|
|
||||||
|
- name: Generate a changelog
|
||||||
|
uses: orhun/git-cliff-action@v4
|
||||||
|
id: git-cliff
|
||||||
|
with:
|
||||||
|
config: cliff.toml
|
||||||
|
args: v2.4.5-rc.2.. --verbose
|
||||||
|
env:
|
||||||
|
OUTPUT: CHANGELOG.md
|
||||||
|
GITHUB_REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
- name: Print the changelog
|
||||||
|
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
||||||
|
|
||||||
|
- name: Commit changelog
|
||||||
|
run: |
|
||||||
|
git checkout master
|
||||||
|
git config --local user.name 'belomaxorka'
|
||||||
|
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
||||||
|
set +e
|
||||||
|
git add CHANGELOG.md
|
||||||
|
git commit -m "release(preparing): Update CHANGELOG.md 📖"
|
||||||
|
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
||||||
|
|
||||||
|
checksums:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- changelog
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: master
|
||||||
|
token: ${{ secrets.REPO_TOKEN }}
|
||||||
|
|
||||||
|
- name: Generate checksums.md5 file
|
||||||
|
run: |
|
||||||
|
find . -type f -not -path "./.git/*" -exec md5sum {} \; > internal_data/checksums.md5
|
||||||
|
|
||||||
|
- name: Commit and push checksums.md5 if changed
|
||||||
|
run: |
|
||||||
|
git checkout master
|
||||||
|
git config --local user.name 'belomaxorka'
|
||||||
|
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
||||||
|
|
||||||
|
if git diff --quiet internal_data/checksums.md5; then
|
||||||
|
echo "No changes in internal_data/checksums.md5"
|
||||||
|
else
|
||||||
|
set +e
|
||||||
|
git add internal_data/checksums.md5
|
||||||
|
git commit -m "release(preparing): Update checksums.md5 📄"
|
||||||
|
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
||||||
|
fi
|
115
.github/workflows/ci.yml
vendored
115
.github/workflows/ci.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Continuous integration
|
name: Continuous Integration
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -6,66 +6,65 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changelog:
|
nightly:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- 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: Get commit hash
|
||||||
|
id: get_commit_hash
|
||||||
|
run: |
|
||||||
|
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||||
|
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Create archive
|
||||||
|
id: create_zip
|
||||||
|
run: |
|
||||||
|
ZIP_NAME="torrentpier-${{ steps.get_commit_hash.outputs.COMMIT_HASH }}.zip"
|
||||||
|
zip -r "$ZIP_NAME" . -x ".git/*" ".github/*"
|
||||||
|
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Upload Archive
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: TorrentPier
|
||||||
|
path: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: 🎉 Deploy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 🔩 Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
php-version: '8.1'
|
||||||
ref: master
|
|
||||||
token: ${{ secrets.REPO_TOKEN }}
|
|
||||||
|
|
||||||
- name: Generate a changelog
|
- name: 🖇 Install Composer dependencies
|
||||||
uses: orhun/git-cliff-action@v4
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
id: git-cliff
|
|
||||||
|
- name: 📂 Sync files
|
||||||
|
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||||
with:
|
with:
|
||||||
config: cliff.toml
|
server: ${{ secrets.FTP_SERVER }}
|
||||||
args: v2.4.5-rc.2.. --verbose
|
username: ${{ secrets.FTP_USERNAME }}
|
||||||
env:
|
password: ${{ secrets.FTP_PASSWORD }}
|
||||||
OUTPUT: CHANGELOG.md
|
server-dir: ${{ secrets.FTP_DIR }}
|
||||||
GITHUB_REPO: ${{ github.repository }}
|
protocol: ${{ secrets.FTP_PROTOCOL }}
|
||||||
|
port: ${{ secrets.FTP_PORT }}
|
||||||
- name: Print the changelog
|
exclude: |
|
||||||
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
**/.git*
|
||||||
|
**/.git*/**
|
||||||
- name: Commit changelog
|
.env
|
||||||
run: |
|
|
||||||
git checkout master
|
|
||||||
git config --local user.name 'belomaxorka'
|
|
||||||
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
|
||||||
set +e
|
|
||||||
git add CHANGELOG.md
|
|
||||||
git commit -m "Update CHANGELOG.md 📖"
|
|
||||||
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
|
||||||
|
|
||||||
checksums:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- changelog
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: master
|
|
||||||
token: ${{ secrets.REPO_TOKEN }}
|
|
||||||
|
|
||||||
- name: Generate checksums.md5 file
|
|
||||||
run: |
|
|
||||||
find . -type f -not -path "./.git/*" -exec md5sum {} \; > internal_data/checksums.md5
|
|
||||||
|
|
||||||
- name: Commit and push checksums.md5 if changed
|
|
||||||
run: |
|
|
||||||
git checkout master
|
|
||||||
git config --local user.name 'belomaxorka'
|
|
||||||
git config --local user.email 'roman25052006.kelesh@gmail.com'
|
|
||||||
|
|
||||||
if git diff --quiet internal_data/checksums.md5; then
|
|
||||||
echo "No changes in internal_data/checksums.md5"
|
|
||||||
else
|
|
||||||
set +e
|
|
||||||
git add internal_data/checksums.md5
|
|
||||||
git commit -m "Update checksums.md5 📄"
|
|
||||||
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
|
||||||
fi
|
|
||||||
|
|
36
.github/workflows/deploy.yml
vendored
36
.github/workflows/deploy.yml
vendored
|
@ -1,36 +0,0 @@
|
||||||
name: Deploy to TorrentPier Demo
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
name: 🎉 Deploy
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: 🚚 Get latest code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- 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: 📂 Sync files
|
|
||||||
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
|
||||||
with:
|
|
||||||
server: ${{ secrets.FTP_SERVER }}
|
|
||||||
username: ${{ secrets.FTP_USERNAME }}
|
|
||||||
password: ${{ secrets.FTP_PASSWORD }}
|
|
||||||
server-dir: ${{ secrets.FTP_DIR }}
|
|
||||||
protocol: ${{ secrets.FTP_PROTOCOL }}
|
|
||||||
port: ${{ secrets.FTP_PORT }}
|
|
||||||
exclude: |
|
|
||||||
**/.git*
|
|
||||||
**/.git*/**
|
|
||||||
.env
|
|
|
@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
|
||||||
|
|
||||||
global $bb_cfg;
|
global $bb_cfg;
|
||||||
|
|
||||||
if (!$bb_cfg['integrity_check']) {
|
if (!$bb_cfg['integrity_check'] || APP_ENV === 'local') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue