Add release job #42
Workflow file for this run
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
name: Checks | |
on: | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
push: | |
branches: | |
# latest release | |
- main | |
# maintenance releases | |
- v[0-9]+.x.x | |
- v[0-9]+.[0-9]+.x | |
env: | |
CI: true | |
jobs: | |
pipeline: | |
name: Checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile --prefer-offline | |
- name: Detect file changes | |
id: changed-files | |
uses: tj-actions/changed-files@v41 | |
with: | |
files_yaml: | | |
eslint_config: | |
- .eslintrc.js | |
- .eslintignore | |
- yarn.lock | |
eslint_target: | |
- "**/*.{ts,js,vue}" | |
- name: Lint all files | |
id: lint-all | |
if: ${{ github.event_name == 'push' || steps.changed-files.outputs.eslint_config_any_changed == 'true' }} | |
run: yarn lint . | |
- name: Lint changed files | |
if: ${{ steps.lint-all.outcome == 'skipped' && steps.changed-files.outputs.eslint_target_any_changed == 'true' }} | |
run: yarn lint ${{ steps.changed-files.outputs.eslint_target_all_changed_files }} --no-error-on-unmatched-pattern | |
- name: Build observability package | |
run: yarn build-pkg observability | |
- name: Generate changeset status | |
run: | | |
yarn changeset status \ | |
--since $(jq -r '.baseBranch' .changeset/config.json) \ | |
--output changeset-status.json | |
- name: Print release title | |
run: jq -r '"Release " + ([.releases[] | "`\(.name)@\(.oldVersion) -> \(.newVersion)`"] | join(", "))' changeset-status.json | |
# creates a PR if there are changesets or publishes the changesets if the PR is merged | |
- name: Create Release Pull Request OR Publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# CHANGESET_BASE_BRANCH: jq -r '.baseBranch' .changeset/config.json | |
# RELEASE_TITLE: jq -r '"Release " + ([.releases[] | "`\(.name)@\(.oldVersion) -> \(.newVersion)`"] | join(", "))' /tmp/changeset-status.json | |
# prevents this step from running on forks AND only on pushes and .changeset.baseBranch is the target branch | |
if: github.repository_owner == 'StackVista' | |
uses: changesets/action@v1 | |
with: | |
# title: ${{ env.RELEASE_TITLE }} | |
# commit: ${{ env.RELEASE_TITLE}} | |
publish: echo "Create Release" |