-
Notifications
You must be signed in to change notification settings - Fork 34
81 lines (77 loc) · 2.84 KB
/
version-and-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
71
72
73
74
75
76
77
78
79
80
81
name: Version/Release
on:
push:
branches:
- master
workflow_dispatch: {}
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
version:
runs-on: ubuntu-latest
outputs:
published: ${{ steps.version.outputs.published }}
focalVersion: ${{ steps.jq.outputs.output && fromJson(steps.jq.outputs.output).focal }}
focalAtomVersion: ${{ steps.jq.outputs.output && fromJson(steps.jq.outputs.output).focalAtom }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install packages
run: yarn install --frozen-lockfile
- name: Create Release Pull Request or Version
id: version
uses: changesets/action@v1
with:
version: yarn changeset version
publish: yarn changeset tag
commit: Version packages
title: Release packages
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ steps.version.outputs.published == 'true' }}
uses: edwardgeorge/jq-action@v1
id: jq
with:
input: ${{ steps.version.outputs.publishedPackages }}
script: |
map({ key: .name, value: .version }) |
from_entries |
{
focal: .["@grammarly/focal"],
focalAtom: .["@grammarly/focal-atom"]
}
publish:
runs-on: ubuntu-latest
needs: version
if: ${{ needs.version.outputs.published == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install packages
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Test
run: yarn test
- name: Package
run: yarn package
- name: Upload @grammarly/focal binaries to release
if: ${{ needs.version.outputs.focalVersion }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./packages/focal/grammarly-focal-v${{ needs.version.outputs.focalVersion }}.tgz
asset_name: grammarly-focal-v${{ needs.version.outputs.focalVersion }}.tgz
tag: '@grammarly/focal@${{ needs.version.outputs.focalVersion }}'
- name: Upload @grammarly/focal-atom binaries to release
if: ${{ needs.version.outputs.focalAtomVersion }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./packages/focal-atom/grammarly-focal-atom-v${{ needs.version.outputs.focalAtomVersion }}.tgz
asset_name: grammarly-focal-atom-v${{ needs.version.outputs.focalAtomVersion }}.tgz
tag: '@grammarly/focal-atom@${{ needs.version.outputs.focalAtomVersion }}'