-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(github): 🏗️ add Release Workflow and configuration files for autom…
…ated releases
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
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,78 @@ | ||
name: Release Workflow | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout 📖 | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: actions/checkout@v4 | ||
|
||
- name: Tag major, minor, and patch versions 🏷️ | ||
if: ${{ steps.release.outputs.release_created }} | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
# Extract version components | ||
VERSION=${{ steps.release.outputs.version }} | ||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | ||
# Add and push tags for major, minor, and patch versions | ||
git tag -a "v$MAJOR" -m "Release v$MAJOR" | ||
git tag -a "v$MAJOR.$MINOR" -m "Release v$MAJOR.$MINOR" | ||
git tag -a "v$MAJOR.$MINOR.$PATCH" -m "Release v$MAJOR.$MINOR.$PATCH" | ||
git push origin "v$MAJOR" | ||
git push origin "v$MAJOR.$MINOR" | ||
git push origin "v$MAJOR.$MINOR.$PATCH" | ||
# Cleanup old tags if needed (optional) | ||
git tag -d "v$MAJOR" || true | ||
git tag -d "v$MAJOR.$MINOR" || true | ||
git push origin :refs/tags/v$MAJOR || true | ||
git push origin :refs/tags/v$MAJOR.$MINOR || true | ||
- name: Enable corepack and pnpm ⚙️ | ||
run: | | ||
corepack enable | ||
corepack prepare pnpm@latest --activate | ||
pnpm config set store-dir ~/.pnpm-store | ||
- name: Use Node.js ⚙️ 22 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: 'pnpm' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Cache dependencies 🔒 | ||
id: cache-pnpm-store | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('package.json') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('.github/workflows/nodejs.yml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies 📦 | ||
run: | | ||
pnpm install --frozen-lockfile | ||
- name: Publish to npm 🚀 | ||
if: ${{ steps.release.outputs.release_created }} | ||
run: | | ||
pnpm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,3 @@ | ||
{ | ||
".": "2.0.4" | ||
} |
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,10 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", | ||
"packages": { | ||
".": { | ||
"release-type": "node", | ||
"tag-separator": "@", | ||
"package-name": "@devexteam/dvx-cli" | ||
} | ||
} | ||
} |