update workflow urls #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
unzip windows.zip | |
cp "d2-${D2_VERSION}-windows-amd64/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/* |