Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

216 - Make CD generic #217

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 13 additions & 45 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ on:
required: true
type: string
description: "yarn workspace name"
command:
secrets:
CARGO_REGISTRY_TOKEN:
required: true
VSCE_PAT:
required: true
type: string
description: "yarn command to run"
workflow_dispatch:
inputs:
workspace:
required: true
type: string
description: "yarn workspace name"
command:
required: true
type: string
description: "yarn command to run"

jobs:
build:
Expand Down Expand Up @@ -50,42 +47,13 @@ jobs:
- os: macos-11
target: aarch64-apple-darwin
code-target: darwin-arm64
runs-on: ${{ matrix.os }}
#container: ${{ matrix.container }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3

- name: Setup yarn
id: setup-yarn
run: |
corepack enable
corepack prepare yarn@stable --activate
yarn set version stable
yarn -v

- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'

- run: yarn workspace ${{ inputs.workspace }} run ${{ inputs.command }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
uses: ./.github/workflows/execute-yarn-workspace-command.yml
with:
workspace: ${{ inputs.workspace }}
command: build
os: ${{ matrix.os }}
target: ${{ matrix.target }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

74 changes: 74 additions & 0 deletions .github/workflows/cd-auto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Auto CD

on:
workflow_call:


jobs:
find-last-commit:
runs-on: ubuntu-latest
outputs:
commit: ${{ steps.last-commit.outputs.commit }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Last Commit
id: last-commit
run: echo "commit=$(git log --oneline HEAD~1 -1 --format=format:%H)" >> $GITHUB_OUTPUT

setup:
needs: find-last-commit
uses: ./.github/workflows/detect-workspace-changes.yml
with:
from: ${{ github.sha }}
since: ${{ needs.find-last-commit.outputs.commit }}

publish-libraries:
if : ${{ needs.setup.outputs.libraries != '[]' && github.ref_name == 'main' }}
needs: setup
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.libraries)}}
uses: ./.github/workflows/publish-library.yml
with:
workspace: ${{ matrix.workspace.name }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}



publish-core:
if: ${{ needs.setup.outputs.extensions != '[]' && github.ref_name == 'main' }}
needs:
- setup
- publish-libraries
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.extensions)}}
uses: ./.github/workflows/publish-core.yml
with:
workspace: ${{ matrix.workspace.name }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

publish-extensions:
if : ${{ needs.setup.outputs.extensions != '[]' }}
needs:
- setup
- publish-libraries
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.extensions)}}
uses: ./.github/workflows/publish-extension-auto.yml
with:
workspace: ${{ matrix.workspace.name }}
pre-release: ${{ github.ref_name != 'main' }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
68 changes: 68 additions & 0 deletions .github/workflows/cd-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Manual CD

on:
workflow_dispatch:
inputs:
from:
description: 'From commit'
required: true
type: string
since:
description: 'Since commit'
required: true
type: string

jobs:
setup:
uses: ./.github/workflows/detect-workspace-changes.yml
with:
from: ${{ github.sha }}
since: ${{ inputs.since }}

publish-libraries:
if : ${{ needs.setup.outputs.libraries != '[]' && github.ref_name == 'main' }}
needs: setup
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.libraries)}}
uses: ./.github/workflows/publish-library.yml
with:
workspace: ${{ matrix.workspace.name }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}



publish-core:
if: ${{ needs.setup.outputs.extensions != '[]' && github.ref_name == 'main' }}
needs:
- setup
- publish-libraries
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.extensions)}}
uses: ./.github/workflows/publish-core.yml
with:
workspace: ${{ matrix.workspace.name }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

publish-extensions:
if : ${{ needs.setup.outputs.extensions != '[]' }}
needs:
- setup
- publish-libraries
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.extensions)}}
uses: ./.github/workflows/publish-extension-auto.yml
with:
workspace: ${{ matrix.workspace.name }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
Loading