This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
Configure Renovate #9
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
CI: 1 | |
ARTIFACT_DIR: ./artifacts | |
jobs: | |
commit-watch: | |
name: Run Commit Watch | |
runs-on: ubuntu-20.04 | |
if: "github.event_name == 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- uses: ./.github/actions/detect-env | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Create artifacts directory | |
run: mkdir -p ${{ env.ARTIFACT_DIR }} | |
- name: Run Commit Watch | |
env: | |
COMMIT_WATCH_OUTPUT_DIR: ${{ env.ARTIFACT_DIR }}/ | |
COMMITWATCH_GITHUB_TOKEN: ${{ secrets.TOPHAT_BOT_GH_TOKEN }} | |
CI_REPO_OWNER: ${{ github.repository_owner }} | |
CI_REPO_NAME: ${{ github.event.repository.name }} | |
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
CI_BASE_BRANCH: origin/${{ github.base_ref }} | |
run: yarn dlx commit-watch | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: commit-watch-artifacts | |
path: ${{ env.ARTIFACT_DIR }} | |
tests: | |
name: Lint & Tests | |
runs-on: ubuntu-20.04 | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/detect-env | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Create artifacts directory | |
run: mkdir -p ${{ env.ARTIFACT_DIR }} | |
- name: Restore yarn cache | |
id: yarn-cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
./.yarn | |
.pnp.* | |
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
run: | | |
yarn install --immutable | |
- name: Set GitHub user for tests | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Top Hat Open Source" | |
git config --global init.defaultBranch main | |
- name: Tests | |
run: yarn test:ci | |
- name: Linting | |
run: yarn lint:ci | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: report-artifacts | |
path: ${{ env.ARTIFACT_DIR }} | |
publish_preview: | |
name: Publish Preview | |
runs-on: ubuntu-20.04 | |
if: "github.event_name == 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/detect-env | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Create artifacts directory | |
run: mkdir -p ${{ env.ARTIFACT_DIR }} | |
- name: Restore yarn cache | |
id: yarn-cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
./.yarn | |
.pnp.* | |
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Run Monodeploy in Dry Run Mode | |
id: run-monodeploy | |
env: | |
PREVIEW: 1 | |
run: | | |
echo "<!-- MONODEPLOY:BELOW -->" > ${{ env.ARTIFACT_DIR }}/CHANGELOG.md | |
yarn monodeploy --dry-run \ | |
--config-file monodeploy.config.js \ | |
--log-level 0 \ | |
--git-base-branch origin/${{ github.base_ref }} \ | |
--prepend-changelog ${{ env.ARTIFACT_DIR }}/CHANGELOG.md \ | |
--force-write-change-files | |
changelog_body=$(cat ${{ env.ARTIFACT_DIR }}/CHANGELOG.md) | |
changelog_body="${changelog_body//'%'/'%25'}" | |
changelog_body="${changelog_body//$'\n'/'%0A'}" | |
changelog_body="${changelog_body//$'\r'/'%0D'}" | |
echo ::set-output name=changelog::$changelog_body | |
- name: Check for Changelog Comment | |
uses: peter-evans/find-comment@v1 | |
id: found-comment | |
if: github.event_name == 'pull_request' | |
with: | |
token: ${{ secrets.TOPHAT_BOT_GH_TOKEN }} | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'tophat-opensource-bot' | |
body-includes: <!-- MONODEPLOY_CHANGELOG_PREVIEW --> | |
- name: Post Changelog to PR | |
uses: peter-evans/create-or-update-comment@v1 | |
if: github.event_name == 'pull_request' | |
with: | |
token: ${{ secrets.TOPHAT_BOT_GH_TOKEN }} | |
comment-id: ${{ steps.found-comment.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
edit-mode: replace | |
body: | | |
<!-- MONODEPLOY_CHANGELOG_PREVIEW --> | |
# Monodeploy Publish Preview | |
This Pull Request introduces the following changes: | |
${{ steps.run-monodeploy.outputs.changelog }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-artifacts | |
path: ${{ env.ARTIFACT_DIR }} |