Skip to content

Commit

Permalink
💚 github actions summary
Browse files Browse the repository at this point in the history
  • Loading branch information
trydofor committed Oct 15, 2024
1 parent 5710bb5 commit a63d8fa
Showing 1 changed file with 34 additions and 29 deletions.
63 changes: 34 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: Auto Test/Bump/Release

on:
push:
Expand All @@ -9,7 +9,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release to Npmjs
name: Auto Test/Bump/Release
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -22,21 +22,21 @@ jobs:
with:
fetch-depth: 0

- uses: actions/cache@v4
name: Cache pnpm store
- name: Caching Toolchain
uses: actions/cache@v4
id: cache-sdk-repo
with:
path: |
~/.asdf/
~/.local/share/pnpm/store/
key: asdf-store-${{ runner.os }}

- name: Install asdf & tools
- name: Install Toolchain
uses: asdf-vm/actions/install@v3
with:
skip_install: ${{ steps.cache-sdk-repo.outputs.cache-hit == 'true' }}

- name: Install Dependencies
- name: Prepare Project
run: |
chmod a+x .changeset/bump-top.sh
echo "install pnpm-hoist-layer to devDep"
Expand All @@ -48,35 +48,38 @@ jobs:
# https://github.com/changesets/action
cat > "$HOME/.npmrc" << EOF
//registry.npmjs.org/:_authToken=$NPM_TOKEN
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
echo "Packaging Envs:" >> $GITHUB_STEP_SUMMARY
echo "## 1.Project Version" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Name | Version |" >> $GITHUB_STEP_SUMMARY
echo "|------|---------|" >> $GITHUB_STEP_SUMMARY
echo "| node | $(node -v) |" >> $GITHUB_STEP_SUMMARY
echo "| pnpm | $(pnpm -v) |" >> $GITHUB_STEP_SUMMARY
echo "| $(jq -r '.name' package.json) | $(jq -r '.version' package.json) |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- node: $(node -v)" >> $GITHUB_STEP_SUMMARY
echo "- pnpm: $(pnpm -v)" >> $GITHUB_STEP_SUMMARY
echo "- revi: $(jq -r '.version' package.json)" >> $GITHUB_STEP_SUMMARY
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Testing
- name: Test and Coverage
run: |
pnpm dev:test
- name: 'Common Coverage'
- name: 2.Coverage of
if: always()
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Common'
working-directory: './layers/common'
- name: 'Mobile Coverage'
- name: 3.Coverage of
if: always()
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Mobile'
working-directory: './layers/mobile'

- name: Bumping or Release
- name: Changeset Auto
id: changesets
uses: changesets/action@v1
with:
Expand All @@ -87,30 +90,32 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publishing Report
- name: Changeset Status
if: steps.changesets.outputs.published == 'true' || steps.changesets.outputs.hasChangesets == 'true'
run: |
echo "Publish Result:" >> $GITHUB_STEP_SUMMARY
echo "## 4.Changeset Status" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Published: ${{ steps.changesets.outputs.published }}" >> $GITHUB_STEP_SUMMARY
echo "- Has Changesets: ${{ steps.changesets.outputs.hasChangesets }}" >> $GITHUB_STEP_SUMMARY
echo "- Pull Request Number: ${{ steps.changesets.outputs.pullRequestNumber }}" >> $GITHUB_STEP_SUMMARY
echo "| Status | Value |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Published | ${{ steps.changesets.outputs.published }} |" >> $GITHUB_STEP_SUMMARY
echo "| Changeset | ${{ steps.changesets.outputs.hasChangesets }} |" >> $GITHUB_STEP_SUMMARY
echo "| PR Number | ${{ steps.changesets.outputs.pullRequestNumber }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- name: Published Package
- name: Publish to Npmjs
if: steps.changesets.outputs.published == 'true'
run: |
pnpm publish --access public
echo "Published Packages:" >> $GITHUB_STEP_SUMMARY
echo "## 5.Publishing Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
publishedPackages='${{ steps.changesets.outputs.publishedPackages }}'
name=$(jq -r '.name' package.json)
version=$(jq -r '.version' package.json)
echo "- Package: $name, Version: $version" >> $GITHUB_STEP_SUMMARY
echo "| Package | Version |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|---------|" >> $GITHUB_STEP_SUMMARY
echo "| $(jq -r '.name' package.json) | $(jq -r '.version' package.json) |" >> $GITHUB_STEP_SUMMARY
# Format published packages
publishedPackages='${{ steps.changesets.outputs.publishedPackages }}'
echo "$publishedPackages" | jq -c '.[]' | while read pkg; do
name=$(echo $pkg | jq -r '.name')
version=$(echo $pkg | jq -r '.version')
echo "- Package: $name, Version: $version" >> $GITHUB_STEP_SUMMARY
echo "| $(echo $pkg | jq -r '.name') | $(echo $pkg | jq -r '.version') |" >> $GITHUB_STEP_SUMMARY
done
echo "" >> $GITHUB_STEP_SUMMARY

0 comments on commit a63d8fa

Please sign in to comment.