-
Notifications
You must be signed in to change notification settings - Fork 4
87 lines (74 loc) · 2.84 KB
/
publish.yml
File metadata and controls
87 lines (74 loc) · 2.84 KB
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
name: Publish to marketplace
on:
workflow_dispatch:
inputs:
version:
description: "The package version to create (ex: 1.0.0)"
required: true
jobs:
verify-package-version:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Extract branch name
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Ensure package version is properly set
run: |
echo """
import json, sys
with open('package.json') as version_file:
version = json.load(version_file)['version']
if version != sys.argv[1]:
raise ValueError(f'Invalid version {version} / {sys.argv[1]}')
""" > /tmp/check1.py
python /tmp/check1.py "${{ github.event.inputs.version }}"
- name: Validate branch name
run: |
echo """
import json, sys, re
with open('package.json') as version_file:
version = json.load(version_file)['version']
x = re.search(r'(\d+)\.(\d+)\.(\d+)(?:\.([a-zA-Z0-9_]+))?', version)
if not x:
raise ValueError('Invalid version expression')
if f'release/{x[1]}.{x[2]}' != sys.argv[1]:
raise ValueError(
f'Branch name mismatch: release/{x[1]}.{x[2]} != {sys.argv[1]}'
)
""" > /tmp/check.py
python /tmp/check.py "${{ steps.extract_branch.outputs.branch }}"
publish:
needs: [verify-package-version]
timeout-minutes: 20
environment: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: get core latest version tag
run: echo "core_version=$(git ls-remote --tags --refs --sort='-version:refname' https://github.com/Avaiga/taipy-core [0-9]\* | head -1 | cut --delimiter='/' --field=3)" >> $GITHUB_OUTPUT
id: extract_core_version
- name: Download core schema file
working-directory: ./schemas
run: |
[ "${{ steps.extract_core_version.outputs.core_version }}" != "" ]
curl --fail-with-body https://raw.githubusercontent.com/Avaiga/taipy-core/${{ steps.extract_core_version.outputs.core_version }}/src/taipy/core/config/config.schema.json -o core.config.schema.json
- name: setup node version
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install webviews node_modules
working-directory: ./webviews
run: npm ci --include=dev
- name: Install node_modules
run: npm ci --include=dev
- name: Build the package
run: npm run package
- name: Publish
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}