@@ -3,25 +3,33 @@ name: Publish
33
44on :
55 push :
6- branches : [ "main" ]
7- tags : [ "**" ]
6+ tags :
7+ - v*
8+
9+ permissions :
10+ contents : write
811
912env :
1013 CARGO_TERM_COLOR : always
1114
1215jobs :
13- required :
14- name : Required
15- needs :
16- - ci
16+ create_release :
17+ name : Release pushed tag
1718 runs-on : ubuntu-20.04
1819 steps :
19- - name : Check results
20+ - name : Create release
21+ env :
22+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23+ GIT_TAG : ${{ github.ref_name }}
2024 run : |
21- [[ ${{ needs.ci.result }} == 'success' ]] || exit 1;
22-
23- ci :
24- name : CI
25+ gh release create "$GIT_TAG" \
26+ --repo="$GITHUB_REPOSITORY" \
27+ --title="${GIT_TAG#v}" \
28+ --generate-notes
29+ artifacts :
30+ name : Create artifacts
31+ needs :
32+ - create_release
2533 strategy :
2634 fail-fast : false
2735 matrix :
5765 - name : Build
5866 run : cargo build --verbose --release
5967
60- - name : Create extension file (.so)
61- uses : actions/upload-artifact@v4
62- with :
63- name : php-extension-${{ matrix.os }}-${{ matrix.php-version }}
64- path : target/release/libphp_ext_fs_notify.so
68+ - name : Create Linux extension file (.so)
69+ if : matrix.os == 'ubuntu-20.04'
70+ env :
71+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72+ GIT_TAG : ${{ github.ref_name }}
73+ run : |
74+ mv target/release/libphp_ext_fs_notify.so target/release/linux-php${{ matrix.php-version }}-libphp_ext_fs_notify.so
75+ gh release upload "$GIT_TAG" \
76+ --repo="$GITHUB_REPOSITORY" \
77+ target/release/linux-php${{ matrix.php-version }}-libphp_ext_fs_notify.so
78+
79+ - name : Create Macos extension file (.dylib)
80+ if : matrix.os == 'macos-12'
81+ env :
82+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
83+ GIT_TAG : ${{ github.ref_name }}
84+ run : |
85+ mv target/release/libphp_ext_fs_notify.dylib target/release/macos-php${{ matrix.php-version }}-libphp_ext_fs_notify.dylib
86+ gh release upload "$GIT_TAG" \
87+ --repo="$GITHUB_REPOSITORY" \
88+ target/release/macos-php${{ matrix.php-version }}-libphp_ext_fs_notify.dylib
0 commit comments