Skip to content

Tim/514 288 stitch the backend and frontend together for the console … #42

Tim/514 288 stitch the backend and frontend together for the console …

Tim/514 288 stitch the backend and frontend together for the console … #42

Workflow file for this run

name: Release CLI
on:
push:
branches:
- main
paths:
- ".github/workflows/release-cli.yaml"
- "apps/moose-cli-npm/**"
- "apps/framework-cli/**"
- "apps/create-moose-app/**"
- "apps/moose-console/**"
- "packages/**"
workflow_dispatch:
inputs:
dry-run:
type: boolean
description: "Run the release in dry-run mode"
required: true
default: true
jobs:
version:
concurrency: release
if: ${{ ! contains(github.event.head_commit.message , '[no-release]') }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Generate Version
id: version
run: |
./scripts/version.js ${{ github.sha }} >> "$GITHUB_OUTPUT"
- name: Create Release
uses: ncipollo/release-action@v1
if: ${{ !inputs.dry-run }}
with:
tag: v${{ steps.version.outputs.VERSION }}
generateReleaseNotes: true
commit: ${{ github.sha }}
build-and-publish-binaries:
name: Build CLI Binaries
runs-on: ${{ matrix.build.os }}
needs: version
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
outputs:
version: ${{ steps.version.outputs.version }}
strategy:
fail-fast: false
matrix:
build:
- {
NAME: linux-x64-glibc,
OS: ubuntu-20.04,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-gnu,
}
- {
NAME: linux-arm64-glibc,
OS: ubuntu-20.04,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-gnu,
}
- {
NAME: darwin-x64,
OS: macos-11,
TOOLCHAIN: stable,
TARGET: x86_64-apple-darwin,
}
- {
NAME: darwin-arm64,
OS: macos-11,
TOOLCHAIN: stable,
TARGET: aarch64-apple-darwin,
}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.build.TOOLCHAIN }}
target: ${{ matrix.build.TARGET }}
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install Set Version
run: |
cargo install cargo-edit
cargo set-version ${{ needs.version.outputs.version }}
working-directory: ./apps/framework-cli
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
# --features rdkafka/cmake-build is necessary for cross compilation builds
args: --manifest-path ./apps/framework-cli/Cargo.toml --features rdkafka/cmake-build --release --locked --target ${{ matrix.build.TARGET }}
use-cross: ${{ matrix.build.OS == 'ubuntu-20.04' }} # use `cross` for Linux builds
- name: Install node
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
- name: Publish to NPM Moose
if: ${{ !inputs.dry-run }}
shell: bash
working-directory: ./apps/moose-cli-npm
run: ./scripts/release-bin.sh ${{ needs.version.outputs.version }} ${{ matrix.build.TARGET }} ${{ matrix.build.OS }} ${{ matrix.build.NAME }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload binary
uses: ncipollo/release-action@v1
if: ${{ !inputs.dry-run }}
with:
tag: v${{ needs.version.outputs.version }}
allowUpdates: "true"
replacesArtifacts: "false"
artifacts: |
./apps/framework-cli/target/${{ matrix.build.TARGET }}/release/moose-cli-${{ matrix.build.TARGET }}
publish-npm-base:
name: Publish the base NPM package
needs:
- version
- build-and-publish-binaries
runs-on: ubuntu-20.04
if: ${{ !inputs.dry-run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 100
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Login GSAP
shell: bash
run: |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
- name: Install node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
- name: Publish the NPM Moose CLI package
shell: bash
run: ./apps/moose-cli-npm/scripts/release-cli.sh ${{ needs.version.outputs.version }}
- name: Publish the NPM Moose create app package
shell: bash
run: ./apps/create-moose-app/scripts/release.sh ${{ needs.version.outputs.version }}
- name: Notify Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_IGLOO_CLI_PROJECT }}
with:
environment: production
version: ${{ needs.version.outputs.version }}
build-and-publish-console:
name: Moose Console
runs-on: ubuntu-20.04
needs: version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/moose-console/Dockerfile
push: ${{ !inputs.dry-run }}
tags: 514labs/moose-console:latest, 514labs/moose-console:0.0.0, 514labs/moose-console:${{ needs.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
TURBO_TEAM=${{ vars.TURBO_TEAM }}
build-and-publish-fullstack-image:
name: Moose Production images
runs-on: ubuntu-20.04
needs:
- version
- build-and-publish-binaries
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./apps/framework-cli/deploy
file: ./apps/framework-cli/deploy/Dockerfile.fullstack
push: ${{ !inputs.dry-run }}
tags: 514labs/moose-fullstack:latest, 514labs/moose-fullstack:0.0.0, 514labs/moose-fullstack:${{ needs.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
FRAMEWORK_VERSION=${{ needs.version.outputs.version }}