mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-24 07:05:47 -07:00
misc(workflow): Some improvements (#1810)
* misc(workflow): Some improvements * Updated * Update cd.yml * Update schedule.yml * Create cd.yml * Update cd.yml * Update schedule.yml * Update cd.yml
This commit is contained in:
parent
1b751c72a7
commit
c168c3956c
3 changed files with 85 additions and 62 deletions
63
.github/workflows/cd.yml
vendored
63
.github/workflows/cd.yml
vendored
|
@ -6,8 +6,9 @@ on:
|
||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changelog:
|
generate-changelog:
|
||||||
runs-on: ubuntu-latest
|
name: Generate changelog
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
outputs:
|
outputs:
|
||||||
release_body: ${{ steps.git-cliff.outputs.content }}
|
release_body: ${{ steps.git-cliff.outputs.content }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -15,72 +16,24 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.REPO_TOKEN }}
|
|
||||||
|
|
||||||
- name: Generate a changelog
|
- name: Generate a changelog
|
||||||
uses: orhun/git-cliff-action@v4
|
uses: orhun/git-cliff-action@v4
|
||||||
id: git-cliff
|
id: git-cliff
|
||||||
with:
|
with:
|
||||||
config: cliff.toml
|
config: cliff.toml
|
||||||
args: v2.4.5-rc.2.. --verbose
|
args: -vv --latest --no-exec --github-repo ${{ github.repository }}
|
||||||
env:
|
|
||||||
OUTPUT: CHANGELOG.md
|
|
||||||
GITHUB_REPO: ${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Print the changelog
|
- name: Print the changelog
|
||||||
run: cat "${{ steps.git-cliff.outputs.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
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create release
|
name: Create release
|
||||||
needs:
|
needs: [ generate-changelog ]
|
||||||
- checksums
|
|
||||||
- changelog
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set the release version
|
- name: Set the release version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
||||||
|
@ -106,11 +59,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
||||||
file_glob: true
|
|
||||||
overwrite: true
|
overwrite: true
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
release_name: "TorrentPier v${{ env.RELEASE_VERSION }}"
|
release_name: "TorrentPier v${{ env.RELEASE_VERSION }}"
|
||||||
body: "${{ needs.changelog.outputs.release_body }}"
|
body: "${{ needs.generate-changelog.outputs.release_body }}"
|
||||||
|
|
||||||
- name: Publish to GitHub (pre-release)
|
- name: Publish to GitHub (pre-release)
|
||||||
if: ${{ contains(github.ref, '-') }}
|
if: ${{ contains(github.ref, '-') }}
|
||||||
|
@ -118,9 +70,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
||||||
file_glob: true
|
|
||||||
overwrite: true
|
overwrite: true
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
release_name: "TorrentPier v${{ env.RELEASE_VERSION }}"
|
release_name: "TorrentPier v${{ env.RELEASE_VERSION }}"
|
||||||
body: "${{ needs.changelog.outputs.release_body }}"
|
body: "${{ needs.generate-changelog.outputs.release_body }}"
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
|
@ -7,34 +7,35 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nightly:
|
nightly:
|
||||||
|
name: Nightly builds 📦
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code 🗳
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP 🔩
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.1'
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies 🪚
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Get commit hash
|
- name: Get commit hash 🔗
|
||||||
id: get_commit_hash
|
id: get_commit_hash
|
||||||
run: |
|
run: |
|
||||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||||
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create archive
|
- name: Create archive 🗞
|
||||||
id: create_zip
|
id: create_zip
|
||||||
run: |
|
run: |
|
||||||
ZIP_NAME="torrentpier-${{ steps.get_commit_hash.outputs.COMMIT_HASH }}.zip"
|
ZIP_NAME="torrentpier-${{ steps.get_commit_hash.outputs.COMMIT_HASH }}.zip"
|
||||||
zip -r "$ZIP_NAME" . -x ".git/*" ".github/*"
|
zip -r "$ZIP_NAME" . -x ".git/*" ".github/*"
|
||||||
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Upload Archive
|
- name: Upload Archive 📤
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: TorrentPier
|
name: TorrentPier
|
||||||
|
|
71
.github/workflows/schedule.yml
vendored
Normal file
71
.github/workflows/schedule.yml
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
name: Changelog & checksums generation
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changelog:
|
||||||
|
name: Changelog generation
|
||||||
|
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 "Update CHANGELOG.md 📖"
|
||||||
|
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git master
|
||||||
|
|
||||||
|
checksums:
|
||||||
|
name: Generate checksums.md5 file
|
||||||
|
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... "
|
||||||
|
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
|
Loading…
Add table
Add a link
Reference in a new issue