forked from co3moz/minecraft-render
-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (93 loc) · 2.53 KB
/
ci.yml
File metadata and controls
109 lines (93 loc) · 2.53 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Build and publish packages
on:
push:
branches: "*"
tags: "v*"
workflow_dispatch:
inputs:
release:
type: boolean
env:
PYTHON_VERSION: '3.11'
NODE_VERSION: '18.x'
jobs:
build-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install deps
run: npm ci
- name: Compile TypeScript
run: tsc --build
- name: Create tarball
id: pack
run: echo "tarball=$(npm pack)" >> "$GITHUB_OUTPUT"
- name: Upload package artifact
uses: actions/upload-artifact@v3
with:
name: build-js
path: ${{ steps.pack.outputs.tarball }}
build-py:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install . hatch
- name: Build package
run: hatch build
- name: Upload package artifact
uses: actions/upload-artifact@v3
with:
name: build-py
path: dist/py
publish-npm:
runs-on: ubuntu-latest
needs: [build-js, build-py]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') || github.event_name == 'workflow_dispatch' && inputs.release
outputs:
release: true
environment:
name: npm
url: https://www.npmjs.com/package/@leftsquarebracket/minecraft-render
permissions:
id-token: write
steps:
- name: Download package artifact
uses: actions/download-artifact@v3
with:
name: build-js
path: dist
- name: Rename tarball
run: mv dist/*.tgz package.tgz
- name: Publish package
uses: JS-DevTools/npm-publish@v3
with:
package: package.tgz
token: ${{ secrets.NPM_TOKEN }}
provenance: true
access: public
publish-pypi:
runs-on: ubuntu-latest
needs: [publish-npm]
if: needs.publish-npm.outputs.release
environment:
name: pypi
url: https://pypi.org/p/minecraft-render
permissions:
id-token: write
steps:
- name: Download package artifact
uses: actions/download-artifact@v3
with:
name: build-py
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1