Skip to content

Commit

Permalink
chore(release.yml): add environment variable for GITHUB_TOKEN and imp…
Browse files Browse the repository at this point in the history
…rove release workflow with cache and validation steps

perf(release.yml): optimize release notes generation and add file existence check to ensure build success
  • Loading branch information
anpigon committed Nov 15, 2024
1 parent c646c9c commit 44abfa4
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ on:

permissions:
contents: write

env:
GH_TOKEN: ${{ github.token }}
issues: write # Release 노트 작성을 위해
pull-requests: write # Release 관련 PR 필요시

jobs:
build:
Expand All @@ -30,19 +29,40 @@ jobs:
with:
node-version-file: '.nvmrc'

- name: Cache pnpm modules
id: pnpm-cache # use this to check for `cache-hit` ==> if: steps.pnpm-cache.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
if: steps.pnpm-cache.outputs.cache-hit != 'true'
run: pnpm install

- name: Build plugin
run: pnpm run build
continue-on-error: false

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF#refs/tags/}" \
git log $(git describe --tags --abbrev=0)..HEAD --oneline > release-notes.md \
tag="${GITHUB_REF#refs/tags/}"
git log "$(git describe --tags --abbrev=0)"..HEAD --oneline > release-notes.md
# 파일 존재 확인
files=("manifest.json" "main.js" "styles.css")
for file in "${files[@]}"; do
if [ ! -f "$file" ]; then
echo "Error: 빌드 결과물 '$file'을 찾을 수 없습니다. 빌드 단계가 성공적으로 완료되었는지 확인해주세요."
exit 1
fi
done

gh release create "$tag" \
--title="$tag" \
--title="Release $tag" \
--notes-file="release-notes.md" \
manifest.json build/main.js build/styles.css

0 comments on commit 44abfa4

Please sign in to comment.