Skip to content

Commit

Permalink
ci(release): Make the release CI workable (#54)
Browse files Browse the repository at this point in the history
`fetch-depth: 0` is needed to get the tags.
  • Loading branch information
5ouma authored Aug 31, 2024
1 parent e131755 commit 740cb0f
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
paths:
- deno.json
workflow_dispatch:

permissions:
contents: write
Expand All @@ -18,28 +19,24 @@ jobs:
steps:
- name: 🚚 Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: πŸ“¦ Get the Package Version
uses: notiz-dev/github-action-json-property@a5a9c668b16513c737c3e1f8956772c99c73f6e8 # v0.2.0
id: version
with:
path: deno.json
prop_path: version
fetch-depth: 0

- name: πŸ” Detect the Version has Changed
id: version-has-changed
- name: πŸ” Check the Version
id: version
run: |
version="$(jq -r '.version' deno.json)"
tag="$(git tag -l | sort -V | tail -n 1)"
if [[ "$tag" == "v${{ steps.version.outputs.prop }}" ]]; then
echo "stop=true" | tee -a "$GITHUB_OUTPUT"
if [[ "v$version" != "$tag" ]]; then
echo "next=v$version" >> "$GITHUB_OUTPUT"
fi
- name: πŸš€ Rrelease a New Version
if: ${{ steps.version-has-changed.outputs.stop != 'true' }}
run: gh release create "v${{ steps.version.outputs.prop }}" --generate-notes
if: ${{ steps.version.outputs.next != '' }}
run: gh release create "${{ steps.version.outputs.next }}" --generate-notes
env:
GH_TOKEN: ${{ github.token }}

- name: ⬆️ Publish to JSR
if: ${{ steps.version-has-changed.outputs.stop != 'true' }}
- name: πŸ“¦ Publish to JSR
if: ${{ steps.version.outputs.next != '' }}
run: npx jsr publish

0 comments on commit 740cb0f

Please sign in to comment.