Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Release Workflow

Release Workflow #46

Workflow file for this run

name: Release Workflow
on:
workflow_dispatch:
inputs:
release_type:
description: "Release type (patch, minor, major)"
required: true
default: "patch"
jobs:
bump_version:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
SHA: ${{ steps.get_commit_sha.outputs.SHA }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Git config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Bump version
run: |
pnpm bump_version:packages ${{ github.event.inputs.release_type }}
pnpm bump_version ${{ github.event.inputs.release_type }}
- name: Get version
id: get_version
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- name: Commit changes
run: |
git add .
git commit -m "Bump version to ${{ steps.get_version.outputs.VERSION }}"
git tag v${{ steps.get_version.outputs.VERSION }}
- name: Get commit SHA
id: get_commit_sha
run: echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Switch Branch
run: git checkout -b release_${{ steps.get_version.outputs.VERSION }}
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: release_${{ steps.get_version.outputs.VERSION }}
tags: true
- name: Create Pull Request
run: |
gh pr create \
--title "Release v${{ steps.get_version.outputs.VERSION }}" \
--body "This PR bumps the version to v${{ steps.get_version.outputs.VERSION }}." \
--base main \
--head release_${{ steps.get_version.outputs.VERSION }}
lint:
runs-on: ubuntu-latest
needs: bump_version
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.bump_version.outputs.SHA }}
- name: Set Commit Status Pending
uses: myrotvorets/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: lint
description: "Running lint"
sha: ${{ needs.bump_version.outputs.SHA }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run lint
run: pnpm lint
- name: Set Commit Status
uses: myrotvorets/[email protected]
if: ${{ always() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: lint
sha: ${{ needs.bump_version.outputs.SHA }}
test:
runs-on: ubuntu-latest
needs: bump_version
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.bump_version.outputs.SHA }}
- name: Set Commit Status Pending
uses: myrotvorets/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: test
description: "Running test"
sha: ${{ needs.bump_version.outputs.SHA }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Get installed Playwright version
id: playwright_version
run: echo VERSION="$(pnpm exec playwright --version | sed 's/Version //g')" >> $GITHUB_OUTPUT
- name: Cache playwright binaries
uses: actions/cache@v4
id: playwright_cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright_version.outputs.VERSION }}
- run: pnpm install-playwright
if: steps.playwright_cache.outputs.cache-hit != 'true'
- name: Run test
run: pnpm test
- name: Set Commit Status
uses: myrotvorets/[email protected]
if: ${{ always() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: test
sha: ${{ needs.bump_version.outputs.SHA }}
release:
runs-on: ubuntu-latest
needs:
- bump_version
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.bump_version.outputs.SHA }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Package
run: |
pnpm zip
pnpm zip:firefox
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "apps/browser_extension/dist/a11y-visualizer-*.zip"
generateReleaseNotes: true
name: "Release v${{ needs.bump_version.outputs.VERSION }}"
tag: v${{ needs.bump_version.outputs.VERSION }}
draft: true