diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 0bc8f81f..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -name: CI -on: - push: - branches: [main] - pull_request: - types: [opened, synchronize] -jobs: - build: - name: Test and build - runs-on: ${{ matrix.os }} - strategy: - matrix: - node: [14, 16] - os: - - macos-latest - - ubuntu-latest - - windows-latest - include: - - node: 14 - os: ubuntu-latest - checkUpToDate: true - steps: - - name: Setup repo - uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - name: Find cache - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: Restore cache - uses: actions/cache@v2 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Install dependencies - run: yarn install --frozen-lockfile --check-files - - name: Lint package - run: yarn lint - - name: Test package - run: yarn test - - name: Build clean - run: yarn clean - - name: Build package - run: yarn build - - name: Build up-to-date - if: ${{ matrix.checkUpToDate }} - run: | - echo "โš ๏ธ If this step fails, the build is outdated." - echo " > run 'yarn build' and commit changes" - git diff --stat --exit-code build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b9f7de4..7a13cd34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,51 +1,43 @@ ---- -name: Release +name: release + on: workflow_dispatch: inputs: release: - description: 'type "release" to confirm creating a new release (main branch only)' + description: 'type "release" to create the release (main branch only)' required: false + +concurrency: + group: release + cancel-in-progress: true + +env: + release: ${{ github.ref == 'refs/heads/main' && github.event.inputs.release == 'release' }} + jobs: release: - name: Release version runs-on: ubuntu-latest steps: - - name: Setup repo + - name: ๐Ÿ— Setup repo uses: actions/checkout@v2 - - name: Setup node + + - name: ๐Ÿ— Setup Node uses: actions/setup-node@v2 with: - node-version: 14.x - - name: Find cache - id: yarn-cache-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: Restore cache - uses: actions/cache@v2 - with: - path: ${{ steps.yarn-cache-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Install dependencies + node-version: 16.x + cache: yarn + + - name: ๐Ÿ“ฆ Install dependencies run: yarn install --frozen-lockfile --check-files - - name: Lint package - run: yarn lint - - name: Test package - run: yarn test - - name: Build clean - run: yarn clean - - name: Build package - run: yarn build - - name: Build up-to-date - run: git diff --stat --exit-code build - - name: Test-run release - if: success() && github.event.inputs.release != 'release' + + - name: ๐Ÿ“‹ Dry-running release + if: ${{ !env.release }} run: yarn semantic-release --dry-run env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create release - if: success() && github.event.inputs.release == 'release' && github.ref == 'refs/heads/main' + + - name: ๐Ÿ“‹ Release code + if: ${{ env.release }} run: yarn semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 00000000..09fb7e0b --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,54 @@ +name: review + +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize] + +concurrency: + group: review-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + node: [16.x] + os: + - macos-latest + - ubuntu-latest + - windows-latest + include: + - node: 16.x + os: ubuntu-latest + checkBuild: true + runs-on: ${{ matrix.os }} + steps: + - name: ๐Ÿ— Setup repo + uses: actions/checkout@v2 + + - name: ๐Ÿ— Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: yarn + + - name: ๐Ÿ“ฆ Install dependencies + run: yarn install --frozen-lockfile --check-files + + - name: โœ… Lint code + run: yarn lint + + - name: ๐Ÿงช Test code + run: yarn test + + - name: ๐Ÿ‘ท Build code + run: yarn build + + - name: ๐Ÿ•ต๏ธ Validate code + if: ${{ matrix.checkBuild }} + run: | + echo "โš ๏ธ If this step fails, the build is outdated." + echo " > run 'yarn build' and commit changes" + git diff --stat --exit-code build