allow on workflow_dispatch #1030
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
name: Test, Build & Publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: "**" | |
tags: | |
- v* | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: install pnpm | |
run: npm i -g pnpm | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: pnpm install, build, and test | |
run: | | |
pnpm install | |
pnpm run lint | |
pnpm run build | |
pnpm run test | |
env: | |
CI: true | |
ember-try: | |
name: ember-try (${{ matrix.scenario }}) | |
needs: test | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
env: | |
CI: "true" | |
strategy: | |
fail-fast: false | |
matrix: | |
experimental: [false] | |
scenario: | |
- release | |
include: | |
- scenario: beta | |
experimental: true | |
- scenario: canary | |
experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: install pnpm | |
run: npm i -g pnpm | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies (pnpm) | |
run: pnpm install | |
# - name: Setup ember-try scenario | |
# working-directory: ./test-app | |
# run: ./node_modules/.bin/ember try:one ember-${{ matrix.scenario }} --skip-cleanup --- cat package.json | |
- name: Build V2 addon | |
working-directory: ./carbon-components-ember | |
run: pnpm run build | |
- name: Run test | |
working-directory: ./test-app | |
run: pnpm run test:ember | |
deploy: | |
needs: [test, ember-try] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: install pnpm | |
run: npm i -g pnpm | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: pnpm install, build, and deploy docs | |
run: | | |
mkdir ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
pnpm install | |
version=$(cat ./carbon-components-ember/package.json | jq -r '.version') | |
git fetch --unshallow | |
git fetch --all --tags | |
TAG=v$version | |
cd ./carbon-components-ember | |
pnpm run build | |
cd .. | |
cd doc-app | |
if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then | |
ADDON_DOCS_UPDATE_LATEST=false ADDON_DOCS_VERSION_PATH=$GITHUB_REF_NAME ./node_modules/.bin/ember deploy production | |
ADDON_DOCS_UPDATE_LATEST=true ADDON_DOCS_VERSION_PATH=$GITHUB_REF_NAME ./node_modules/.bin/ember deploy production | |
fi | |
ADDON_DOCS_UPDATE_LATEST=false ADDON_DOCS_VERSION_PATH=main ./node_modules/.bin/ember deploy production | |
env: | |
CI: true | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} |