Build and Publish #7057
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: Build and Publish | |
| on: | |
| pull_request: {} | |
| push: | |
| branches: | |
| - main | |
| - stable | |
| - ember-2.7.0-3.4.0 | |
| - ember-0.0.0-2.7.0 | |
| tags: | |
| - v* | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| env: | |
| CI: 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Code Climate expects these variables to be set | |
| - name: Set up commit metadata | |
| if: github.event_name == 'push' | |
| env: | |
| GIT_COMMIT_SHA: ${{ github.sha }} | |
| GIT_BRANCH: ${{ github.ref }} | |
| run: | | |
| echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}" >> $GITHUB_ENV | |
| echo "GIT_BRANCH=${GIT_BRANCH/refs\/heads\//}" >> $GITHUB_ENV | |
| - name: Set up commit metadata | |
| if: github.event_name == 'pull_request' | |
| env: | |
| GIT_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
| GIT_BRANCH: ${{ github.event.pull_request.head.ref }} | |
| run: | | |
| echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}" >> $GITHUB_ENV | |
| echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install | |
| - name: Lint (hbs) | |
| run: pnpm lint:hbs | |
| - name: Lint (js) | |
| run: pnpm lint:js | |
| - name: Run test | |
| run: pnpm test | |
| env: | |
| COVERAGE: 'true' | |
| # Ideally, we would split up the test task into separate build and run | |
| # steps to get better CI log output (folding and timing information). | |
| # However, this is not currently possible with ember-cli-code-coverage. | |
| # | |
| # See https://github.com/kategengler/ember-cli-code-coverage/issues/210 | |
| # | |
| # - name: Build | |
| # run: pnpm ember build --environment test | |
| # env: | |
| # COVERAGE: 'true' | |
| # - name: Run test | |
| # run: COVERAGE pnpm ember test --path dist | |
| # env: | |
| # # Due to a bug in ember-cli, running `ember test` with `--path` doesn't set `EMBER_ENV=test` | |
| # # See https://github.com/ember-cli/ember-cli/issues/8922 | |
| # EMBER_ENV: test | |
| # COVERAGE: 'true' | |
| - name: Report coverage | |
| if: github.event_name != 'schedule' | |
| run: pnpm codeclimate-test-reporter < coverage/lcov.info | |
| env: | |
| CODECLIMATE_REPO_TOKEN: 59edcfd1ffc778791af49ca594b503e7179f6bbe1991b2cc0c0a6987d103253d | |
| ember-try: | |
| name: ember-try (${{ matrix.scenario }}) | |
| needs: test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| env: | |
| CI: 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| scenario: | |
| - ember-lts-3.16 | |
| - ember-lts-3.20 | |
| - ember-lts-3.24 | |
| - ember-lts-3.28 | |
| - ember-lts-4.8 | |
| - ember-lts-4.12 | |
| - ember-lts-5.4 | |
| - ember-lts-5.8 | |
| - ember-lts-5.12 | |
| - ember-release | |
| - ember-beta | |
| - ember-canary | |
| - ember-default-no-prototype-extensions | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install | |
| - name: Set NO_EXTEND_PROTOTYPES | |
| if: matrix.scenario == 'ember-default-no-prototype-extensions' | |
| run: echo "NO_EXTEND_PROTOTYPES==true" >> .GITHUB_ENV | |
| - name: Setup ember-try scenario | |
| run: pnpm ember try:one ${{ matrix.scenario }} --skip-cleanup --- cat package.json | |
| - name: Build | |
| run: pnpm ember build --environment test | |
| - name: Run test | |
| # Due to a bug in ember-cli, running `ember test` with `--path` doesn't set `EMBER_ENV=test` | |
| # See https://github.com/ember-cli/ember-cli/issues/8922 | |
| run: EMBER_ENV=test pnpm ember test --path dist --filter="Ember Debug" | |
| build: | |
| name: Build extensions | |
| runs-on: ubuntu-latest | |
| env: | |
| CI: 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install | |
| - name: Download panes | |
| run: node scripts/download-panes.js | |
| env: | |
| EMBER_ENV: production | |
| - name: Update manifest.json (nightly) | |
| if: github.event_name == 'schedule' | |
| run: | | |
| DATE="$(date +"%Y.%-m.%-d")" | |
| SHA="${GITHUB_SHA:0:7}" | |
| VERSION="$(jq -r '.version' package.json)" | |
| CONTENT="$(cat "$FILE")" | |
| echo "$CONTENT" | jq --arg date "$DATE" --arg sha "$SHA" --arg version "$VERSION" "$FILTER" > $FILE | |
| cat "$FILE" | |
| env: | |
| FILE: skeletons/web-extension/manifest.json | |
| FILTER: >- | |
| .name += " (Nightly)" | | |
| .version = $date | | |
| .version_name = "\($version) (nightly build \($date) / \($sha))" | |
| - name: Update manifest.json (pull request) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| SHA="${SHA:0:7}" | |
| CONTENT="$(cat "$FILE")" | |
| echo "$CONTENT" | jq --arg pr "$PR" --arg sha "$SHA" "$FILTER" > $FILE | |
| cat "$FILE" | |
| env: | |
| FILE: skeletons/web-extension/manifest.json | |
| FILTER: >- | |
| .name += " (PR #\($pr))" | | |
| .version = $pr | | |
| .version_name = $sha | |
| PR: ${{ github.event.pull_request.number }} | |
| SHA: ${{ github.event.pull_request.head.sha }} | |
| - name: Update package.json (nightly) | |
| if: github.event_name == 'schedule' | |
| run: | | |
| DATE="$(date +"%Y.%-m.%-d")" | |
| SHA="${GITHUB_SHA:0:7}" | |
| CONTENT="$(cat "$FILE")" | |
| echo "$CONTENT" | jq --arg date "$DATE" --arg sha "$SHA" "$FILTER" > $FILE | |
| cat "$FILE" | |
| env: | |
| FILE: package.json | |
| FILTER: .version += "-alpha.\($date)+\($sha)" | |
| - name: Update package.json (pull request) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| SHA="${SHA:0:7}" | |
| CONTENT="$(cat "$FILE")" | |
| echo "$CONTENT" | jq --arg pr "$PR" --arg sha "$SHA" "$FILTER" > $FILE | |
| cat "$FILE" | |
| env: | |
| FILE: package.json | |
| FILTER: .version += "-alpha.0.\($pr)+\($sha)" | |
| PR: ${{ github.event.pull_request.number }} | |
| SHA: ${{ github.event.pull_request.head.sha }} | |
| - name: Set EMBER_INSPECTOR_TAB (nightly) | |
| if: github.event_name == 'schedule' | |
| run: echo "EMBER_INSPECTOR_TAB=Nightly" >> $GITHUB_ENV | |
| - name: Set EMBER_INSPECTOR_TAB (pull request) | |
| if: github.event_name == 'pull_request' | |
| run: echo "EMBER_INSPECTOR_TAB=PR \#$PR" >> $GITHUB_ENV | |
| env: | |
| PR: ${{ github.event.pull_request.number }} | |
| - name: Build | |
| run: pnpm build:production | |
| - name: Pack | |
| run: | | |
| VERSION="$(jq -r '.version' package.json)" | |
| pnpm pack | |
| mkdir -p dist/npm | |
| tar xvzf "ember-inspector-$VERSION.tgz" -C dist/npm --strip-components 1 | |
| - name: Upload artifacts (bookmarklet) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bookmarklet | |
| path: dist/bookmarklet | |
| - name: Upload artifacts (Chrome) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrome | |
| path: dist/chrome | |
| - name: Upload artifacts (Firefox) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: firefox | |
| path: dist/firefox | |
| - name: Upload artifacts (npm) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm | |
| path: dist/npm | |
| publish-chrome: | |
| name: Publish Chrome extension | |
| needs: | |
| - test | |
| - ember-try | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up node | |
| uses: actions/setup-node@v4 | |
| - name: Install dependencies (chrome-webstore-upload-cli) | |
| run: npm install -g chrome-webstore-upload-cli | |
| - name: Download artifacts (Chrome) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: chrome | |
| path: chrome | |
| - name: Set Environment Variables | |
| run: | | |
| echo "EXTENSION_ID=ibdbkmdgflhglikhjdbogjjflkialpfi" >> $GITHUB_ENV | |
| echo "CLIENT_ID=${{ secrets.GOOGLE_NIGHTLY_CLIENT_ID }}" >> $GITHUB_ENV | |
| echo "CLIENT_SECRET=${{ secrets.GOOGLE_NIGHTLY_CLIENT_SECRET }}" >> $GITHUB_ENV | |
| echo "REFRESH_TOKEN=${{ secrets.GOOGLE_NIGHTLY_REFRESH_TOKEN }}" >> $GITHUB_ENV | |
| - name: Upload to Chrome Web Store | |
| if: >- | |
| github.event_name == 'schedule' | |
| run: chrome-webstore-upload upload --source chrome --auto-publish |