mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -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*.*.*"
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
runs-on: ubuntu-latest
|
||||
generate-changelog:
|
||||
name: Generate changelog
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
release_body: ${{ steps.git-cliff.outputs.content }}
|
||||
steps:
|
||||
|
@ -15,72 +16,24 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
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 }}
|
||||
args: -vv --latest --no-exec --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
|
||||
|
||||
release:
|
||||
name: Create release
|
||||
needs:
|
||||
- checksums
|
||||
- changelog
|
||||
needs: [ generate-changelog ]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set the release version
|
||||
shell: bash
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
||||
|
@ -106,11 +59,10 @@ jobs:
|
|||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
tag: ${{ github.ref }}
|
||||
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)
|
||||
if: ${{ contains(github.ref, '-') }}
|
||||
|
@ -118,9 +70,8 @@ jobs:
|
|||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ steps.create_zip.outputs.ZIP_NAME }}
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
tag: ${{ github.ref }}
|
||||
release_name: "TorrentPier v${{ env.RELEASE_VERSION }}"
|
||||
body: "${{ needs.changelog.outputs.release_body }}"
|
||||
body: "${{ needs.generate-changelog.outputs.release_body }}"
|
||||
prerelease: true
|
||||
|
|
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
|
@ -7,34 +7,35 @@ on:
|
|||
|
||||
jobs:
|
||||
nightly:
|
||||
name: Nightly builds 📦
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout code 🗳
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
- name: Setup PHP 🔩
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
|
||||
- name: Install Composer dependencies
|
||||
- name: Install Composer dependencies 🪚
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Get commit hash
|
||||
- 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
|
||||
- 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
|
||||
- name: Upload Archive 📤
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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