Skip to content

Commit 084e06d

Browse files
committed
build and publish
1 parent 0731897 commit 084e06d

File tree

2 files changed

+56
-18
lines changed

2 files changed

+56
-18
lines changed

.github/workflows/rust.yml renamed to .github/workflows/ci.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Rust
1+
name: CI
22

33
on:
44
push:
@@ -58,4 +58,18 @@ jobs:
5858
run: cargo build --verbose
5959

6060
- name: Run tests
61-
run: cargo test --verbose
61+
run: cargo test --verbose
62+
63+
- name: Create Linux extension file (.so)
64+
if: matrix.os == 'ubuntu-20.04'
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: php-extension-${{ matrix.os }}-php${{ matrix.php-version }}
68+
path: target/debug/libphp_ext_fs_notify.so
69+
70+
- name: Create Macos extension file (.dylib)
71+
if: matrix.os == 'macos-12'
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: php-extension-${{ matrix.os }}-php${{ matrix.php-version }}
75+
path: target/debug/libphp_ext_fs_notify.dylib

.github/workflows/publish.yml

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,33 @@ name: Publish
33

44
on:
55
push:
6-
branches: [ "main" ]
7-
tags: [ "**" ]
6+
tags:
7+
- v*
8+
9+
permissions:
10+
contents: write
811

912
env:
1013
CARGO_TERM_COLOR: always
1114

1215
jobs:
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:
@@ -57,8 +65,24 @@ jobs:
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

Comments
 (0)