Merge pull request #27 from piotrpdev/release-plz-2025-03-04T21-00-05Z #35
This file contains 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. | |
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/[email protected] | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Setup Node | |
uses: actions/[email protected] | |
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/[email protected] | |
with: | |
packages: libopencv-dev | |
version: "1.0" | |
- name: Install Rust toolchain | |
uses: dtolnay/[email protected] | |
- name: Restore Rust cache | |
uses: Swatinem/[email protected] | |
with: | |
workspaces: ./backend | |
- name: Run release-plz | |
uses: release-plz/[email protected] | |
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/[email protected] | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Install Rust toolchain | |
uses: dtolnay/[email protected] | |
- name: Restore Rust cache | |
uses: Swatinem/[email protected] | |
with: | |
workspaces: ./backend | |
- name: Run release-plz | |
uses: release-plz/[email protected] | |
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 }} |