128 lines
3.7 KiB
YAML
128 lines
3.7 KiB
YAML
name: Release
|
|
|
|
# A push to production is the merge of a release pull request. Check it once more, tag it, tell
|
|
# Packagist, and bring develop up to date, so the next features start from what was released.
|
|
on:
|
|
push:
|
|
branches: [production]
|
|
|
|
concurrency:
|
|
group: release
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
verify:
|
|
runs-on: docker
|
|
container:
|
|
image: webdevops/php:8.4
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: cache composer downloads
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.composer/cache
|
|
key: composer-release-${{ hashFiles('composer.json') }}
|
|
restore-keys: |
|
|
composer-release-
|
|
|
|
- name: install dependencies
|
|
env:
|
|
COMPOSER_MAX_PARALLEL_HTTP: '4'
|
|
run: |
|
|
for attempt in 1 2 3; do
|
|
composer update --prefer-stable --prefer-dist && exit 0
|
|
echo "composer failed (attempt $attempt of 3), trying again" >&2
|
|
sleep $((attempt * 10))
|
|
done
|
|
exit 1
|
|
|
|
- name: pest tests
|
|
run: vendor/bin/pest
|
|
|
|
- name: composer audit
|
|
run: composer audit
|
|
|
|
tag:
|
|
runs-on: docker
|
|
needs: verify
|
|
container:
|
|
image: webdevops/php:8.4
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: release
|
|
run: |
|
|
git config --global --add safe.directory "$(pwd)"
|
|
python3 .gitea/scripts/release.py
|
|
env:
|
|
GT_URL: https://git.iriks.casa
|
|
GT_OWNER: iriks-it
|
|
GT_REPO: laravel-manager
|
|
GT_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
|
COMMIT_HASH: ${{ github.sha }}
|
|
|
|
# Packagist shows every branch of the repository it reads as a dev version (dev-develop, dev-feature/...), and
|
|
# that cannot be switched off. So it reads a mirror that only has the tags: this puts them there.
|
|
mirror:
|
|
runs-on: docker
|
|
needs: tag
|
|
container:
|
|
image: webdevops/php:8.4
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: push the tags
|
|
run: |
|
|
git config --global --add safe.directory "$(pwd)"
|
|
git config --local --unset-all http.https://git.iriks.casa/.extraheader || true
|
|
git -c http.extraheader="Authorization: token ${GT_TOKEN}" push https://git.iriks.casa/iriks-it/laravel-manager-packagist.git 'refs/tags/v*:refs/tags/v*'
|
|
env:
|
|
GT_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
|
|
|
# Needs the secrets PACKAGIST_USERNAME and PACKAGIST_TOKEN on the repository, and the package
|
|
# submitted on packagist.org once. Without them this step only says so.
|
|
packagist:
|
|
runs-on: docker
|
|
needs: [tag, mirror]
|
|
container:
|
|
image: webdevops/php:8.4
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: tell Packagist
|
|
run: python3 .gitea/scripts/packagist.py
|
|
env:
|
|
PACKAGIST_USERNAME: ${{ secrets.PACKAGIST_USERNAME }}
|
|
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
|
|
PACKAGE_URL: https://git.iriks.casa/iriks-it/laravel-manager-packagist
|
|
|
|
# Last: merge what was released into develop. Runs even when Packagist could not be told.
|
|
sync-develop:
|
|
runs-on: docker
|
|
needs: [tag, packagist]
|
|
if: always() && needs.tag.result == 'success'
|
|
container:
|
|
image: webdevops/php:8.4
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: sync develop
|
|
run: python3 .gitea/scripts/sync_develop.py
|
|
env:
|
|
GT_URL: https://git.iriks.casa
|
|
GT_OWNER: iriks-it
|
|
GT_REPO: laravel-manager
|
|
GT_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
|
GT_BOT_USER: deploy-bot
|
|
COMMIT_HASH: ${{ github.sha }}
|