-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (39 loc) · 1.75 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 }}