Skip to content

Commit

Permalink
ci: update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
loveakinlesi committed Sep 3, 2024
1 parent c651e89 commit 12dc77c
Showing 1 changed file with 49 additions and 25 deletions.
74 changes: 49 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,67 @@
name: Release
name: Test, Build, and Release

on:
push:
branches:
- main
tags:
- 'v*.*.*'

jobs:
release:
name: Release
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
fetch-depth: 0
node-version: '18'

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test

- name: Build project
run: pnpm run prepublish

release:
needs: build-and-test
runs-on: ubuntu-latest

- name: Setup Node.js
uses: actions/setup-node@v3
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: '18'

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install Dependencies
- name: Install dependencies
run: pnpm install

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
publish: pnpm publish-packages
files: |
react-dynamic-fonts/dist/**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create GitHub Release
uses: actions/create-release@v1
if: steps.changesets.outputs.published == 'true'
- name: Publish to npm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changesets.outputs.publishedPackages[0].version }}
release_name: Release ${{ steps.changesets.outputs.publishedPackages[0].version }}
body: ${{ steps.changesets.outputs.publishedPackages[0].notes }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm publish --access public

0 comments on commit 12dc77c

Please sign in to comment.