shlink/.github/workflows/publish-release.yml
2022-08-13 10:19:38 +02:00

77 lines
2.1 KiB
YAML

name: Publish release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
php-version: ['8.1']
swoole: ['yes', 'no']
env:
extensions: openswoole-4.11.1
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: publish-release-extensions-${{ matrix.php-version }}-${{ matrix.swoole }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
extensions: ${{ env.extensions }}
- if: ${{ matrix.swoole == 'yes' }}
run: ./build.sh ${GITHUB_REF#refs/tags/v}
- if: ${{ matrix.swoole == 'no' }}
run: ./build.sh ${GITHUB_REF#refs/tags/v} --no-swoole
- uses: actions/upload-artifact@v3
with:
name: dist-files-${{ matrix.php-version }}-${{ matrix.swoole }}
path: build
publish:
needs: ['build']
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: build
- name: Publish release with assets
uses: docker://antonyurchenko/git-release:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ALLOW_EMPTY_CHANGELOG: "true"
with:
args: |
build/*/shlink*_dist.zip
delete-artifacts:
needs: ['publish']
runs-on: ubuntu-22.04
strategy:
matrix:
php-version: ['8.1']
swoole: ['yes', 'no']
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: dist-files-${{ matrix.php-version }}-${{ matrix.swoole }}