1
+ name : Tag-release
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - v*
7
+
8
+ jobs :
9
+ release :
10
+ name : Test on php ${{ matrix.php}}
11
+ runs-on : ubuntu-latest
12
+ timeout-minutes : 10
13
+ strategy :
14
+ fail-fast : true
15
+ matrix :
16
+ php : [7.4]
17
+
18
+ steps :
19
+ - name : Checkout
20
+ uses : actions/checkout@v2
21
+
22
+ - name : Set ENV for github-release
23
+ # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
24
+ run : |
25
+ echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
26
+ echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
27
+
28
+ # usage refer https://github.com/shivammathur/setup-php
29
+ - name : Setup PHP
30
+ timeout-minutes : 5
31
+ uses : shivammathur/setup-php@v2
32
+ with :
33
+ php-version : ${{ matrix.php}}
34
+ tools : pecl, php-cs-fixer, phpunit
35
+ extensions : mbstring, dom, fileinfo, mysql, openssl # , swoole-4.4.19 #optional, setup extensions
36
+ ini-values : post_max_size=56M, short_open_tag=On # optional, setup php.ini configuration
37
+ coverage : none # optional, setup coverage driver: xdebug, none
38
+
39
+ - name : Install dependencies # eg: v1.0.3
40
+ run : |
41
+ echo $RELEASE_TAG
42
+ echo $RELEASE_NAME
43
+ tag1=${GITHUB_REF#refs/*/}
44
+ echo "release tag: ${tag1}"
45
+ composer update --no-progress
46
+
47
+ # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
48
+ # Docs: https://getcomposer.org/doc/articles/scripts.md
49
+
50
+ # https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context
51
+ # - name: Generate changelog file
52
+ # id: changelog
53
+ # run: |
54
+ # php bin/kite gh cl prev $RELEASE_TAG --style gh-release --no-merges --fetch-tags --unshallow --file tmp/changelog-${RELEASE_TAG}.md
55
+ # cat tmp/changelog-${RELEASE_TAG}.md
56
+
57
+ # https://github.com/meeDamian/github-release
58
+ # - name: Create release and upload assets
59
+ # uses: meeDamian/[email protected]
60
+ # with:
61
+ # gzip: false
62
+ # token: ${{ secrets.GITHUB_TOKEN }}
63
+ # tag: ${{ env.RELEASE_TAG }}
64
+ # name: ${{ env.RELEASE_TAG }}
65
+ # body: |
66
+ # ${{ steps.changelog.outputs.CHLOGBODY }}
67
+ # files: kite-${{ env.RELEASE_TAG }}.phar
68
+
69
+ # https://github.com/softprops/action-gh-release
70
+ - name : Create release and upload assets
71
+ uses : softprops/action-gh-release@v1
72
+ # if: startsWith(github.ref, 'refs/tags/')
73
+ with :
74
+ name : ${{ env.RELEASE_TAG }}
75
+ tag_name : ${{ env.RELEASE_TAG }}
76
+ # body_path: tmp/changelog-${{ env.RELEASE_TAG }}.md
77
+ # files: kite-${{ env.RELEASE_TAG }}.phar
78
+ env :
79
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
80
+ # GITHUB_REPOSITORY: my_gh_org/my_gh_repo
0 commit comments