Update repository URL in Cargo.toml and README.md to reflect the new … #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build for ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| artifact-name: pomodoro-plugin-windows-x86_64.dll | |
| library-name: pomodoro_plugin.dll | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| artifact-name: pomodoro-plugin-linux-x86_64.so | |
| library-name: libpomodoro_plugin.so | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| artifact-name: pomodoro-plugin-macos-x86_64.dylib | |
| library-name: libpomodoro_plugin.dylib | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-${{ matrix.target }}- | |
| - name: Build plugin | |
| shell: bash | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} | |
| mkdir -p release | |
| cp target/${{ matrix.target }}/release/${{ matrix.library-name }} release/${{ matrix.artifact-name }} | |
| - name: Copy plugin manifest | |
| shell: bash | |
| run: | | |
| cp plugin.toml release/plugin.toml | |
| - name: Build frontend | |
| shell: bash | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm run build | |
| cd .. | |
| mkdir -p release/frontend | |
| cp frontend/dist/index.js release/frontend/index.js | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pomodoro-plugin-${{ matrix.target }} | |
| path: release | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create release archive | |
| shell: bash | |
| run: | | |
| mkdir -p release | |
| # Copy plugin manifest (from any artifact) | |
| for dir in artifacts/*/; do | |
| if [ -f "$dir/plugin.toml" ]; then | |
| cp "$dir/plugin.toml" release/ | |
| break | |
| fi | |
| done | |
| # Copy backend libraries with correct names | |
| for dir in artifacts/*/; do | |
| # Windows DLL | |
| if [ -f "$dir/pomodoro-plugin-windows-x86_64.dll" ]; then | |
| cp "$dir/pomodoro-plugin-windows-x86_64.dll" release/ | |
| fi | |
| # Linux SO | |
| if [ -f "$dir/pomodoro-plugin-linux-x86_64.so" ]; then | |
| cp "$dir/pomodoro-plugin-linux-x86_64.so" release/ | |
| fi | |
| # macOS dylib | |
| if [ -f "$dir/pomodoro-plugin-macos-x86_64.dylib" ]; then | |
| cp "$dir/pomodoro-plugin-macos-x86_64.dylib" release/ | |
| fi | |
| done | |
| # Copy frontend (from any artifact directory) | |
| for dir in artifacts/*/; do | |
| if [ -d "$dir/frontend" ]; then | |
| cp -r "$dir/frontend" release/ | |
| break | |
| fi | |
| done | |
| # Create zip archive | |
| cd release | |
| zip -r ../pomodoro-plugin-${{ github.ref_name }}.zip . | |
| cd .. | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: pomodoro-plugin-${{ github.ref_name }}.zip | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |