Merge pull request #43 from piotrpdev/release-plz-2025-04-30T21-06-16Z #55
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
| # Code taken from https://release-plz.dev/docs/github/quickstart | |
| name: Release-plz | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'backend/**' | |
| - '.github/workflows/release-plz.yml' | |
| # - 'frontend/**' # No point, release-plz only creates new release when Rust code changes. | |
| workflow_dispatch: | |
| jobs: | |
| # Release unpublished packages. | |
| release-plz-release: | |
| name: Release-plz release | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # Generating a GitHub token, so that PRs and tags created by | |
| # the release-plz-action can trigger actions workflows. | |
| - name: Generate GitHub token | |
| uses: actions/create-github-app-token@v1 | |
| id: generate-token | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache-dependency-path: ./frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| working-directory: ./frontend | |
| - name: Build frontend | |
| run: npm run build | |
| working-directory: ./frontend | |
| - name: Copy frontend build to backend | |
| run: | | |
| mkdir -p static | |
| cp -r ../frontend/dist/* ./static | |
| working-directory: ./backend | |
| # https://github.com/twistedfall/opencv-rust/blob/master/ci/install-ubuntu.sh#L27 | |
| - name: Use clang workaround | |
| run: sudo ln -fs libclang.so.1 /usr/lib/llvm-14/lib/libclang.so | |
| - name: Restore Apt packages | |
| uses: awalsh128/cache-apt-pkgs-action@v1 | |
| with: | |
| packages: libopencv-dev | |
| version: "1.0" | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@1.81.0 | |
| - name: Restore Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ./backend | |
| - name: Run release-plz | |
| uses: release-plz/action@v0.5 | |
| with: | |
| command: release | |
| manifest_path: ./backend/Cargo.toml | |
| config: ./backend/release-plz.toml | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| # Create a PR with the new versions and changelog, preparing the next release. | |
| release-plz-pr: | |
| name: Release-plz PR | |
| runs-on: ubuntu-22.04 | |
| concurrency: | |
| group: release-plz-${{ github.ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - name: Generate GitHub token | |
| uses: actions/create-github-app-token@v1 | |
| id: generate-token | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@1.81.0 | |
| - name: Restore Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: ./backend | |
| - name: Run release-plz | |
| uses: release-plz/action@v0.5 | |
| with: | |
| command: release-pr | |
| manifest_path: ./backend/Cargo.toml | |
| config: ./backend/release-plz.toml | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |