-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR merges the `release.yml` workflow with `version.yml` as `version-and-release.yml`. How it works: - now the workflow is split into 2 jobs: `version` and `publish` - `version` is responsible for - creating/update release PR if needed when the change is not a new version (has uncommitted changelog) - version packages and create tags and GitHub releases when this is a new version (committed changelog) - after publishing by `changesets` action, the output contains versions of the released packages - this output is transformed by `jq` in a format to easily consume in the next job - `publish` does what `release.yml` used to do: - builds, tests, packs - uploads artifacts to the GitHub releases - now it uses tags for each package as these releases are now separate
- Loading branch information
Showing
3 changed files
with
81 additions
and
69 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 }}' |
This file was deleted.
Oops, something went wrong.