fix: sync shipping-platform patches (rate sheets, connectors, graph, … #226
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: insiders-build | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.changes.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v2 | |
| id: changes | |
| with: | |
| filters: | | |
| version: | |
| - 'apps/api/karrio/server/VERSION' | |
| insiders-wheels: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.version == 'true' || github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| actions: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine setuptools wheel | |
| - id: get_tag | |
| run: | | |
| cat ./apps/api/karrio/server/VERSION | |
| echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV" | |
| - name: Create or get GitHub release | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT }} | |
| run: | | |
| echo 'Checking for existing GitHub release v${{ env.tag }} in karrio-insiders repository...' | |
| if gh release view "v${{ env.tag }}" --repo karrioapi/karrio-insiders >/dev/null 2>&1; then | |
| echo 'Release v${{ env.tag }} already exists in karrio-insiders, using existing release' | |
| else | |
| echo 'Creating new GitHub release v${{ env.tag }} in karrio-insiders repository...' | |
| gh release create "v${{ env.tag }}" \ | |
| --repo karrioapi/karrio-insiders \ | |
| --title "Karrio Insiders v${{ env.tag }}" \ | |
| --notes "Karrio Insiders wheels release v${{ env.tag }}" \ | |
| --draft | |
| fi | |
| - name: Build and publish insiders wheels | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT }} | |
| run: | | |
| echo 'Building and publishing insiders wheels for version ${{ env.tag }}...' | |
| ./bin/publish-insiders-wheels ${{ env.tag }} | |
| insiders-server-build: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.version == 'true' || github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - id: get_tag | |
| run: | | |
| cat ./apps/api/karrio/server/VERSION | |
| echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV" | |
| - name: Build JS client | |
| run: | | |
| docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \ | |
| -i /local/schemas/openapi.yml \ | |
| -g typescript-fetch \ | |
| -o /local/packages/karriojs/api/generated \ | |
| --additional-properties=typescriptThreePlus=true \ | |
| --additional-properties=modelPropertyNaming=snake_case \ | |
| --additional-properties=useSingleRequestParameter=true | |
| cd packages/karriojs | |
| npm ci | |
| npx gulp build --output "${GITHUB_WORKSPACE}/apps/api/karrio/server/static/karrio/js/karrio.js" | |
| cd - | |
| - name: Build embeddable elements | |
| run: | | |
| cd packages/elements | |
| npm ci | |
| npm run build | |
| ELEMENTS_STATIC="${GITHUB_WORKSPACE}/apps/api/karrio/server/static/karrio/elements" | |
| mkdir -p "${ELEMENTS_STATIC}" "${ELEMENTS_STATIC}/chunks" | |
| cp dist/elements.js dist/globals.css "${ELEMENTS_STATIC}/" | |
| cp dist/ratesheet.js dist/ratesheet.html "${ELEMENTS_STATIC}/" | |
| cp dist/devtools.js dist/devtools.css dist/devtools.html "${ELEMENTS_STATIC}/" | |
| cp dist/template-editor.js dist/template-editor.html "${ELEMENTS_STATIC}/" | |
| cp dist/connections.js dist/connections.html "${ELEMENTS_STATIC}/" | |
| [ -d dist/chunks ] && cp dist/chunks/* "${ELEMENTS_STATIC}/chunks/" | |
| cd - | |
| - name: Build insider server image | |
| run: | | |
| echo 'Build and push karrio-insiders server:${{ env.tag }}...' | |
| echo ${{ secrets.GH_PAT }} | docker login ghcr.io -u USERNAME --password-stdin | |
| ./bin/build-insiders-image ${{ env.tag }} && | |
| docker push ghcr.io/karrioapi/server:${{ env.tag }} || exit 1 | |
| insiders-dashboard-build: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.version == 'true' || github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - id: get_tag | |
| run: | | |
| cat ./apps/api/karrio/server/VERSION | |
| echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV" | |
| - name: Login to GHCR | |
| run: echo ${{ secrets.GH_PAT }} | docker login ghcr.io -u USERNAME --password-stdin | |
| - name: Build insider dashboard image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/dashboard/Dockerfile | |
| push: true | |
| tags: ghcr.io/karrioapi/dashboard:${{ env.tag }} | |
| build-args: | | |
| VERSION=${{ env.tag }} | |
| NEXT_PUBLIC_DASHBOARD_VERSION=${{ env.tag }} | |
| SOURCE=https://github.com/karrioapi/karrio-insiders | |
| cache-from: type=gha,scope=insiders-dashboard | |
| cache-to: type=gha,mode=max,scope=insiders-dashboard |