-
-
Notifications
You must be signed in to change notification settings - Fork 215
70 lines (62 loc) · 2.14 KB
/
ci-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: CI and Semantic Release
concurrency:
group: release-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
- alpha
- next
jobs:
test:
name: Build (production)
runs-on: ubuntu-latest
if: ${{ github.repository == 'imbhargav5/rooks' && contains('refs/heads/main,refs/heads/alpha,refs/heads/next',github.ref)}}
steps:
- name: "Check if user has write access"
uses: "lannonbr/repo-permission-check-action@2.0.0"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: ⎔ CI Setup
uses: ./.github/actions/ci-setup
- name: run all checks and get coverage
run: yarn run all-checks
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
directory: packages/rooks/src/coverage
release:
name: Publish To NPM
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{secrets.ALGOLIA_APP_ID}}
needs: test
runs-on: ubuntu-latest
if: ${{ github.repository == 'imbhargav5/rooks' &&
contains('refs/heads/main,refs/heads/alpha,refs/heads/next',github.ref) && github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
with:
# To run comparison we need more than the latest commit. Keep the fetch-depth relatively
# high or set it to zero to get all commits from the git repo.
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
fetch-depth: 0
- name: ⎔ CI Setup
uses: ./.github/actions/ci-setup
- name: 🏗 Run build script
run: yarn run build
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn run release
version: yarn run version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}