|
| 1 | +name: Version/Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + workflow_dispatch: {} |
| 8 | + |
| 9 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + |
| 11 | +jobs: |
| 12 | + version: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + published: ${{ steps.version.outputs.published }} |
| 16 | + focalVersion: ${{ steps.jq.outputs.output && fromJson(steps.jq.outputs.output).focal }} |
| 17 | + focalAtomVersion: ${{ steps.jq.outputs.output && fromJson(steps.jq.outputs.output).focalAtom }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + - uses: actions/setup-node@v3 |
| 21 | + with: |
| 22 | + node-version-file: '.nvmrc' |
| 23 | + - name: Install packages |
| 24 | + run: yarn install --frozen-lockfile |
| 25 | + - name: Create Release Pull Request or Version |
| 26 | + id: version |
| 27 | + uses: changesets/action@v1 |
| 28 | + with: |
| 29 | + version: yarn changeset version |
| 30 | + publish: yarn changeset tag |
| 31 | + commit: Version packages |
| 32 | + title: Release packages |
| 33 | + createGithubReleases: true |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + - if: ${{ steps.version.outputs.published == 'true' }} |
| 37 | + uses: edwardgeorge/jq-action@v1 |
| 38 | + id: jq |
| 39 | + with: |
| 40 | + input: ${{ steps.version.outputs.publishedPackages }} |
| 41 | + script: | |
| 42 | + map({ key: .name, value: .version }) | |
| 43 | + from_entries | |
| 44 | + { |
| 45 | + focal: .["@grammarly/focal"], |
| 46 | + focalAtom: .["@grammarly/focal-atom"] |
| 47 | + } |
| 48 | +
|
| 49 | + publish: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + needs: version |
| 52 | + if: ${{ needs.version.outputs.published == 'true' }} |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v3 |
| 55 | + - uses: actions/setup-node@v3 |
| 56 | + with: |
| 57 | + node-version-file: '.nvmrc' |
| 58 | + - name: Install packages |
| 59 | + run: yarn install --frozen-lockfile |
| 60 | + - name: Build |
| 61 | + run: yarn build |
| 62 | + - name: Test |
| 63 | + run: yarn test |
| 64 | + - name: Package |
| 65 | + run: yarn package |
| 66 | + - name: Upload @grammarly/focal binaries to release |
| 67 | + if: ${{ needs.version.outputs.focalVersion }} |
| 68 | + uses: svenstaro/upload-release-action@v2 |
| 69 | + with: |
| 70 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + file: ./packages/focal/grammarly-focal-v${{ needs.version.outputs.focalVersion }}.tgz |
| 72 | + asset_name: grammarly-focal-v${{ needs.version.outputs.focalVersion }}.tgz |
| 73 | + tag: '@grammarly/focal@${{ needs.version.outputs.focalVersion }}' |
| 74 | + - name: Upload @grammarly/focal-atom binaries to release |
| 75 | + if: ${{ needs.version.outputs.focalAtomVersion }} |
| 76 | + uses: svenstaro/upload-release-action@v2 |
| 77 | + with: |
| 78 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + file: ./packages/focal-atom/grammarly-focal-atom-v${{ needs.version.outputs.focalAtomVersion }}.tgz |
| 80 | + asset_name: grammarly-focal-atom-v${{ needs.version.outputs.focalAtomVersion }}.tgz |
| 81 | + tag: '@grammarly/focal-atom@${{ needs.version.outputs.focalAtomVersion }}' |
0 commit comments