Skip to content

Commit

Permalink
improve release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikbosch committed Jun 11, 2024
1 parent ace2a62 commit 02a9022
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,33 @@ name: Publish

on:
push:
tags: [ "**" ]
workflow_run:
workflows: [ "CI" ]
branches: [ "main" ]
types:
- completed
tags:
- v*

permissions:
contents: write

env:
CARGO_TERM_COLOR: always

jobs:
publish:
name: publish
needs:
- ci
create_release:
name: Release pushed tag
runs-on: ubuntu-20.04
steps:
- name: Check results
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_TAG: ${{ github.ref_name }}
run: |
[[ ${{ needs.ci.result }} == 'success' ]] || exit 1;
ci:
name: CI
gh release create "$GIT_TAG" \
--repo="$GITHUB_REPOSITORY" \
--title="${GIT_TAG#v}" \
--generate-notes
artifacts:
name: Create artifacts
needs:
- create_release
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -63,14 +67,22 @@ jobs:

- name: Create Linux extension file (.so)
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v4
with:
name: php-extension-${{ matrix.os }}-php${{ matrix.php-version }}
path: target/release/libphp_ext_fs_notify.so
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_TAG: ${{ github.ref_name }}
run: |
mv target/release/libphp_ext_fs_notify.so target/release/linux-php${{ matrix.php-version }}-libphp_ext_fs_notify.so
gh release upload "$GIT_TAG" \
--repo="$GITHUB_REPOSITORY" \
target/release/macos-php${{ matrix.php-version }}-libphp_ext_fs_notify.so
- name: Create Macos extension file (.dylib)
if: matrix.os == 'macos-12'
uses: actions/upload-artifact@v4
with:
name: php-extension-${{ matrix.os }}-php${{ matrix.php-version }}
path: target/release/libphp_ext_fs_notify.dylib
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_TAG: ${{ github.ref_name }}
run: |
mv target/release/libphp_ext_fs_notify.dylib target/release/macos-php${{ matrix.php-version }}-libphp_ext_fs_notify.dylib
gh release upload "$GIT_TAG" \
--repo="$GITHUB_REPOSITORY" \
target/release/macos-php${{ matrix.php-version }}-libphp_ext_fs_notify.dylib

0 comments on commit 02a9022

Please sign in to comment.