-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.5 KB
/
main.yml
File metadata and controls
50 lines (41 loc) · 1.5 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
name: Build and Release D2 Python Package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-python:
runs-on: ubuntu-latest
env:
D2_VERSION: "v0.6.8"
steps:
- uses: actions/checkout@v3
- name: Download and extract D2 releases
run: |
mkdir -p d2_python/bin/{linux,win32,darwin}
# Linux
curl -L "https://github.com/terrastruct/d2/releases/download/${D2_VERSION}/d2-${D2_VERSION}-linux-amd64.tar.gz" -o linux.tar.gz
tar xzf linux.tar.gz
cp "d2-${D2_VERSION}/bin/d2" d2_python/bin/linux/d2-bin
# Windows
curl -L "https://github.com/terrastruct/d2/releases/download/${D2_VERSION}/d2-${D2_VERSION}-windows-amd64.tar.gz" -o windows.tar.gz
tar xzf windows.tar.gz
cp "d2-${D2_VERSION}/bin/d2.exe" d2_python/bin/win32/d2-bin.exe
# MacOS
curl -L "https://github.com/terrastruct/d2/releases/download/${D2_VERSION}/d2-${D2_VERSION}-macos-amd64.tar.gz" -o darwin.tar.gz
tar xzf darwin.tar.gz
cp "d2-${D2_VERSION}/bin/d2" d2_python/bin/darwin/d2-bin
chmod +x d2_python/bin/*/d2-bin*
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pip install build twine
python -m build
python -m twine upload dist/*