💚 ci(all): update release #22
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
############################################################################### | |
# PUBLISH CORE IN NPM | |
############################################################################### | |
name: ✅ Test and check for updates | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
############################################################################### | |
# JOBS | |
############################################################################### | |
jobs: | |
checks: | |
name: ✅ Test and check for updates | |
runs-on: ubuntu-latest | |
steps: | |
######################################################################### | |
# INIT | |
######################################################################### | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ env.GITHUB_TOKEN }} | |
- name: ⬇️ Checkout | |
uses: actions/checkout@v4 | |
- name: 🐙😺 Check GitHub API Rate Limit | |
id: rate_limit | |
run: | | |
response=$(gh api rate_limit) | |
limit=$(echo $response | jq -r '.resources.core.limit') | |
remaining=$(echo $response | jq -r '.resources.core.remaining') | |
echo "GitHub API Rate Limit: $remaining/$limit" | |
if [ "$remaining" -lt 10 ]; then | |
exit 1 | |
fi | |
env: | |
GH_TOKEN: ${{ env.GITHUB_TOKEN }} | |
- name: ⬇️🟢 Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: ⬇️🥡 Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: ⬇️📦 Install dependencies | |
run: | | |
pnpm install --no-frozen-lockfile | |
- name: ⬇️🌐 Install Playwright Browsers | |
run: npx playwright install --with-deps | |
######################################################################### | |
# BUILD | |
######################################################################### | |
- name: 🏗 Build | |
run: pnpm build # CMD contains lint, test, and build | |
- name: 🚪 Exit here if is pull request | |
if: github.event_name == 'pull_request' | |
run: | | |
gh run cancel ${{ github.run_id }} | |
gh run watch ${{ github.run_id }} | |
env: | |
GITHUB_TOKEN: ${{env.GITHUB_TOKEN }} | |
######################################################################### | |
######################################################################### | |
# UPDATE VERSIONS | |
######################################################################### | |
######################################################################### | |
- name: 🦋 Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
title: "chore(release): version packages 🦋" | |
publish: pnpm exec changeset publish | |
version: pnpm exec changeset version | |
commit: "chore(release): version packages 🦋 [skip ci]" | |
createGithubReleases: false | |
env: | |
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ env.NPM_TOKEN }} | |
- name: 🦋🗂️ Get updated versions if exists | |
id: updated | |
run: | | |
docs_version=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | select(.name == "@s-8/docs") | .version') | |
exts_version=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | select(.name == "@s-8/exts") | .version') | |
app_version=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | select(.name == "@s-8/app") | .version') | |
core_version=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r 'map(select(.name == "@s-8/app" or .name == "@s-8/exts" or .name == "@s-8/core")) | .[0].version // empty' ) | |
echo Set updated versions | |
echo "CORE=$core_version APP=$app_version EXTS=$exts_version DOCS=$docs_version" | |
echo "core_version=$core_version" >> $GITHUB_OUTPUT | |
echo "docs_version=$docs_version" >> $GITHUB_OUTPUT | |
echo "exts_version=$exts_version" >> $GITHUB_OUTPUT | |
echo "app_version=$app_version" >> $GITHUB_OUTPUT | |
######################################################################### | |
# DOCS | |
######################################################################### | |
- name: 📚🐙😺➡️ Call to workflow for deploy Documentation | |
if: steps.updated.outputs.docs_version != '' | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: release-docs.yml | |
inputs: '{ "version": "${{ steps.updated.outputs.docs_version }}"}' | |
######################################################################### | |
# APP | |
######################################################################### | |
- name: 🖥️🐙😺➡️ Call to workflow for create Github app releases | |
if: steps.updated.outputs.core_version != '' | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: release-apps.yml | |
inputs: '{ "version": "${{ steps.updated.outputs.core_version }}"}' | |
######################################################################### | |
# EXTS | |
######################################################################### | |
- name: 🧩🐙😺➡️ Call to workflow for create Github extension releases | |
if: steps.updated.outputs.core_version != '' | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: release-exts.yml | |
inputs: '{ "version": "${{ steps.updated.outputs.core_version }}"}' | |
############################################################################### |