-
Notifications
You must be signed in to change notification settings - Fork 18
107 lines (95 loc) · 3.31 KB
/
cd-prerelease.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Publish pre-release
on:
schedule:
- cron: '15 4 * * 2' # every tuesday at 4:15AM UTC
workflow_dispatch:
jobs:
check:
name: Check for pre release changes
runs-on: ubuntu-latest
if: github.repository_owner == 'certinia'
permissions:
contents: write
outputs:
exitstatus: ${{ steps.earlyexit.outputs.exitstatus }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: earlyexit
name: Should publish pre release
run: |
echo "Checking if Log Analyzer Pre Release can be published"
headSHA=$(git rev-parse HEAD)
if [ $(git tag -l pre) ]; then
preSHA=$(git rev-parse --verify -q "pre")
fi
stableTag=$(git tag '*.*.*' --list --sort=-version:refname | head -n1 )
stableSHA=$(git rev-parse $stableTag)
echo "HEAD
$(git show $headSHA -s --format="commit: %h Date: %ad")
Pre release
$(git show $preSHA -s --format="commit: %h Date: %ad")
Stable release ($stableTag)
$(git show $stableSHA -s --format="commit: %h Date: %ad")"
if [ "$headSHA" = "$preSHA" ] || [ "$headSHA" = "$stableSHA" ]; then
echo "
No pre-release needed, No changes since last pre-release or stable version. Exiting."
echo "exitstatus=exit" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "exitstatus=continue" >> "$GITHUB_OUTPUT"
publish:
name: Publish pre-release
needs: check
runs-on: ubuntu-latest
if: github.repository_owner == 'certinia' && needs.check.outputs.exitstatus == 'continue'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install vsce + ovsx
run: |
pnpm add --global @vscode/vsce
pnpm add --global ovsx
- name: Dependencies
run: |
HUSKY=0 pnpm install
- name: update pre-release version
run: |
echo "Updating pre-release version"
pnpm run bump-prerelease;
- name: Package the extension
run: |
cd lana
vsce package --pre-release --no-dependencies
- name: Publish to VS Code Marketplace + Open VSX Registry
run: |
cd lana
echo "Verify vsce token has not expired"
vsce verify-pat -p ${{ secrets.VSCE_TOKEN }}
echo "
Verify ovsx token has not expired"
ovsx verify-pat -p ${{ secrets.OVSX_TOKEN }}
versionNum=$(cat package.json | jq -r '.version')
pkgPath=lana-${versionNum}.vsix
echo "Publish to vsce
vsix name: $pkgPath"
vsce publish --packagePath ${pkgPath} --no-dependencies --pre-release --skip-duplicate -p ${{ secrets.VSCE_TOKEN }}
echo "
Publish to ovsx"
ovsx publish ${pkgPath} --no-dependencies --pre-release --skip-duplicate -p ${{ secrets.OVSX_TOKEN }}
- name: Update pre-release tag
run: |
echo "Updating pre release tag"
git tag -f pre
git push -f origin pre