Merge pull request #323 from marko-js/changeset-release/main #511
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: CI | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
push: | |
branches: [main] | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Use node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Format Code | |
run: npm run format | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "[ci] format" | |
commit_user_name: "github-actions[bot]" | |
commit_user_email: "github-actions[bot]@users.noreply.github.com" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
runs-on: ubuntu-latest | |
name: "test: node@${{ matrix.node }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
node: [20] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use node@${{ matrix.node }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Run tests | |
run: xvfb-run -a npm test | |
release: | |
runs-on: ubuntu-latest | |
needs: [format, test] | |
if: "${{ github.repository_owner == 'marko-js' && github.event_name == 'push' }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Release | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: npm run version | |
publish: npm run release | |
commit: "[ci] release" | |
title: "[ci] release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
OVSX_PAT: ${{ secrets.OVSX_PAT }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} |