chore(deps-dev): bump eslint-plugin-import from 2.27.5 to 2.28.1 (#1499) #222
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: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
version: | |
name: Ensure package version match | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Read package.json version | |
uses: sergeysova/jq-action@v2 | |
id: version_package | |
with: | |
cmd: jq --raw-output .version package.json | |
- name: Read GitHub version | |
uses: pozetroninc/github-action-get-latest-release@master | |
id: version_v_github | |
with: | |
owner: MichalLytek | |
repo: type-graphql | |
excludes: prerelease, draft | |
- name: Remove leading v* from GitHub version | |
id: version_github | |
run: | | |
_version="${{ steps.version_v_github.outputs.release }}" | |
printf 'value=%s\n' "${_version#?}" >> "$GITHUB_OUTPUT" | |
- name: Read Git tag version | |
id: version_gittag | |
run: | | |
_version="${{ github.ref_name }}" | |
printf 'value=%s\n' "${_version#?}" >> "$GITHUB_OUTPUT" | |
- name: Compare package.json with Git tag | |
uses: madhead/semver-utils@latest | |
id: comparison_package_gittag | |
with: | |
version: ${{ steps.version_package.outputs.value }} | |
compare-to: ${{ steps.version_gittag.outputs.value }} | |
lenient: false | |
- name: Compare Git tag with GitHub | |
uses: madhead/semver-utils@latest | |
id: comparison_gittag_github | |
with: | |
version: ${{ steps.version_gittag.outputs.value }} | |
compare-to: ${{ steps.version_github.outputs.value }} | |
lenient: false | |
- name: Check package.json == Git tag | |
run: | | |
if [ ! "${{ steps.comparison_package_gittag.outputs.comparison-result }}" = "=" ]; then | |
printf '[ERROR]: package.json (%s) != Git tag (%s)\n' "${{ steps.version_package.outputs.value }}" "${{ steps.version_gittag.outputs.value }}" | |
exit 1 | |
fi | |
- name: Check Git tag > GitHub | |
run: | | |
if [ ! "${{ steps.comparison_gittag_github.outputs.comparison-result }}" = ">" ]; then | |
printf '[ERROR]: Git tag (%s) !> GitHub (%s)\n' "${{ steps.version_gittag.outputs.value }}" "${{ steps.version_github.outputs.value }}" | |
exit 1 | |
fi | |
check: | |
name: Build & Lint & Tests | |
needs: version | |
if: always() && (needs.version.result == 'success' || needs.version.result == 'skipped') | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
node-version: [16.x, 18.x, 20.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies | |
run: | | |
npm ci | |
- name: Build | |
run: | | |
npm run build | |
npm run build:benchmarks | |
- name: Check | |
run: | | |
npm run check | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test | |
run: npm run test:ci | |
env: | |
CI: true | |
- name: Upload code coverage | |
uses: codecov/codecov-action@v3 | |
if: matrix.node-version == '18.x' | |
release: | |
name: Release package on NPM | |
needs: check | |
if: needs.check.result == 'success' && startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Read package.json version | |
uses: sergeysova/jq-action@v2 | |
id: version | |
with: | |
cmd: jq --raw-output .version package.json | |
- name: Determine if version is prerelease | |
id: prerelease | |
run: | | |
_prerelease= | |
if printf "%s\n" "${{ steps.version.outputs.value }}" | grep -q -P '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$'; then | |
_prerelease=false | |
else | |
_prerelease=true | |
fi | |
printf 'value=%s\n' "$_prerelease" >> "$GITHUB_OUTPUT" | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
registry-url: "https://registry.npmjs.org" | |
- name: Install latest npm | |
run: | | |
npm install -g npm@latest | |
- name: Install Dependencies | |
run: | | |
npm ci | |
- name: Prepare package | |
run: | | |
npm run prepublishOnly | |
env: | |
TYPE_GRAPHQL_REF: ${{ github.ref_name }} | |
- name: Build Changelog | |
id: changelog | |
uses: mikepenz/release-changelog-builder-action@v4 | |
with: | |
configuration: "./.github/configs/changelog.json" | |
owner: MichalLytek | |
repo: type-graphql | |
failOnError: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: ${{ steps.changelog.outputs.changelog }} | |
prerelease: ${{ steps.prerelease.outputs.value == 'true' }} | |
- name: Publish | |
run: | | |
_tag= | |
if [ "${{ steps.prerelease.outputs.value }}" = "true" ]; then | |
_tag="next" | |
else | |
_tag="latest" | |
fi | |
npm publish --ignore-scripts --tag "$_tag" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
website: | |
name: Publish website | |
needs: check | |
if: always() && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- name: Install Dependencies | |
run: | | |
npm ci | |
npm ci --prefix ./website | |
- name: Build | |
run: | | |
npm run build --prefix ./website | |
- name: Publish | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./website/build/type-graphql | |
user_name: "github-actions[bot]" | |
user_email: "github-actions[bot]@users.noreply.github.com" | |
full_commit_message: | | |
Deploy website based on ${{ github.sha }} |