|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: bash |
| 13 | + working-directory: cli |
| 14 | + |
| 15 | +jobs: |
| 16 | + release: |
| 17 | + name: Release |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout Repo |
| 21 | + # https://github.com/actions/checkout |
| 22 | + uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Setup Node.js |
| 25 | + # https://github.com/actions/setup-node |
| 26 | + uses: actions/setup-node@v2 |
| 27 | + with: |
| 28 | + node-version: 16.x |
| 29 | + |
| 30 | + - uses: actions/cache@v2 |
| 31 | + id: yarn-cache |
| 32 | + with: |
| 33 | + path: "**/node_modules" |
| 34 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 35 | + |
| 36 | + - name: Install dependencies |
| 37 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 38 | + run: yarn --frozen-lockfile --ignore-scripts |
| 39 | + |
| 40 | + - name: Create Release Pull Request or Publish to npm |
| 41 | + id: changesets |
| 42 | + # https://github.com/changesets/action |
| 43 | + uses: changesets/action@v1 |
| 44 | + with: |
| 45 | + createGithubReleases: false |
| 46 | + publish: yarn release |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 50 | + |
| 51 | + - name: View outputs |
| 52 | + run: echo ${{join(steps.changesets.outputs.*, ' ')}} |
| 53 | + |
| 54 | + - name: Aggregate |
| 55 | + id: aggregate |
| 56 | + if: steps.changesets.outputs.published == 'true' |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 60 | + run: | |
| 61 | + node ./.changeset/aggregate.mjs |
| 62 | +
|
| 63 | + - name: Create Release |
| 64 | + if: steps.changesets.outputs.published == 'true' |
| 65 | + uses: actions/create-release@v1 |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + with: |
| 69 | + tag_name: ${{ steps.aggregate.outputs.version }} |
| 70 | + release_name: ${{ steps.aggregate.outputs.version }} |
| 71 | + body: ${{ steps.aggregate.outputs.notes }} |
| 72 | + draft: false |
| 73 | + prerelease: false |
0 commit comments