From ba1ce8b8ecb1b2587506d6d1b911b21e8958a91f Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 26 Nov 2020 12:44:07 +0900 Subject: [PATCH] Automatic GitHub releases from git tags --- .github/workflows/main.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index febc244b..f4e13a65 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -148,3 +148,25 @@ jobs: ./vendor/bin/phpunit --coverage-clover coverage-clover.xml curl -LO https://scrutinizer-ci.com/ocular.phar php ocular.phar code-coverage:upload --format=php-clover coverage-clover.xml + + release: + runs-on: ubuntu-latest + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} # Otherwise our annotated tag is not fetched and we cannot get correct version + + # Create release + - name: Get release info + id: release-info + run: | + echo "::set-output name=subject::$(git tag --format '%(contents:subject)' --points-at)" + git tag --format '%(contents:body)' --points-at > release-body.txt + - uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: ${{ steps.release-info.outputs.subject }} + body_path: release-body.txt