Skip to content

Publish

Publish #30

Workflow file for this run

name: Publish
on:
workflow_run:
workflows: ["Verify"]
types:
- completed
branches: [main]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Get current version
id: current_version
run: echo "version=$(grep '"version"' deno.json | awk '{ print $2 }' | sed 's/[",]//g')" >> $GITHUB_OUTPUT
- name: Get published version
id: published_version
run: echo "version=$(npx jsr show @justbe/webview | head -n 2 | npx -q strip-ansi-cli | xargs | awk '{print $4}')" >> $GITHUB_OUTPUT
- name: Publish package
if: ${{ steps.current_version.outputs.version != steps.published_version.outputs.version }}
run: npx jsr publish
env:
LATEST_VERSION: ${{ env.latest_version }}
- name: Get latest version
if: ${{ steps.current_version.outputs.version != steps.published_version.outputs.version }}
id: latest_version
run: echo "version=$(npx jsr show @justbe/webview | head -n 2 | npx -q strip-ansi-cli | xargs | awk '{print $4}')" >> $GITHUB_OUTPUT
- name: Tag and push if versions differ
if: ${{ steps.current_version.outputs.version != steps.published_version.outputs.version && steps.latest_version.outputs.version != steps.published_version.outputs.version }}
run: |
git config user.name github-actions
git config user.email [email protected]
git tag -a deno-v${{ steps.latest_version.outputs.version }} -m "Release ${{ steps.latest_version.outputs.version }}"
git push origin deno-v${{ steps.latest_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}