Release packages #426
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: Release packages | |
on: | |
workflow_dispatch: | |
inputs: | |
package: | |
type: 'choice' | |
required: true | |
description: 'Select a package to run the release' | |
options: | |
- all | |
- dialtone | |
- combinator | |
- css | |
- emojis | |
- icons | |
- language-server | |
- tokens | |
- vue2 | |
- vue3 | |
- eslint-plugin | |
- stylelint-plugin | |
- postcss-response-variations | |
schedule: | |
- cron: "0 10 * * 2" | |
env: | |
HUSKY: 0 | |
jobs: | |
get-branch-name: | |
runs-on: ubuntu-latest | |
outputs: | |
current_branch: ${{ steps.branch-name.outputs.current_branch }} | |
steps: | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v8 | |
check-dialpad-member: | |
runs-on: ubuntu-latest | |
steps: | |
# Will prevent the rest of the steps from running on fail | |
- name: Check if user is a dialpad member | |
uses: octokit/request-action@v2.x | |
env: | |
GITHUB_TOKEN: ${{ secrets.DIALTONE_CI_TOKEN_2 }} | |
with: | |
route: GET /orgs/dialpad/members/${{ github.actor }} | |
release: | |
needs: [get-branch-name, check-dialpad-member] | |
if: ${{ contains(fromJSON('["staging", "alpha", "beta"]'), needs.get-branch-name.outputs.current_branch) }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
issues: write | |
pull-requests: write | |
env: | |
RELEASE_TAG: ${{ needs.get-branch-name.outputs.current_branch == 'staging' && 'latest' || needs.get-branch-name.outputs.current_branch }} | |
DIALTONE_VUE3_RELEASE_TAG: ${{ needs.get-branch-name.outputs.current_branch == 'staging' && 'vue3' || needs.get-branch-name.outputs.current_branch }} | |
NPM_TOKEN: ${{ secrets.DIALTONE_NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.DIALTONE_CI_TOKEN_2 }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Use pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: "${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}" | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
# Release to GitHub | |
- name: Release Dialtone ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'dialtone' }} | |
run: pnpm nx run dialtone:release | |
- name: Release Dialtone Combinator ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'combinator' }} | |
run: pnpm nx run dialtone-combinator:release | |
- name: Release Dialtone CSS ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'css' }} | |
run: pnpm nx run dialtone-css:release | |
- name: Release Dialtone Emojis ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'emojis' }} | |
run: pnpm nx run dialtone-emojis:release | |
- name: Release Dialtone Icons ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'icons' }} | |
run: pnpm nx run dialtone-icons:release | |
- name: Release Dialtone Language server ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'language-server' }} | |
run: pnpm nx run dialtone-language-server:release | |
- name: Release Dialtone Tokens ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'tokens' }} | |
run: pnpm nx run dialtone-tokens:release | |
- name: Release Dialtone Vue@${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'vue2' }} | |
run: pnpm nx run dialtone-vue2:release | |
- name: Release Dialtone Vue@${{ env.DIALTONE_VUE3_RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'vue3' }} | |
run: pnpm nx run dialtone-vue3:release | |
- name: Release Dialtone ESLint Plugin ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'eslint-plugin' }} | |
run: pnpm nx run eslint-plugin-dialtone:release | |
- name: Release Dialtone StyleLint Plugin ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'stylelint-plugin' }} | |
run: pnpm nx run stylelint-plugin-dialtone:release | |
- name: Release Dialtone PostCSS Responsive Variations Plugin ${{ env.RELEASE_TAG }} | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'dialtone' }} | |
run: pnpm nx run postcss-responsive-variations:release | |
push: | |
needs: [ release ] | |
if: ${{ needs.get-branch-name.outputs.current_branch == 'staging' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: 'production' | |
fetch-depth: 0 | |
token: ${{ secrets.DIALTONE_CI_TOKEN_2 }} | |
- name: Merge changes to production | |
run: | | |
git merge --ff-only origin/staging | |
git push |