Skip to content

Commit

Permalink
feat(ci): add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdickinson committed Oct 5, 2023
1 parent df61134 commit fe24008
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 1 deletion.
116 changes: 116 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Python Release Build

on:
workflow_dispatch:
push:
branches: [ main ]
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- run: poetry install
- name: set version
shell: bash
run: |
pyproject="$(cat pyproject.toml)"
version="${{ github.ref }}"
if [[ "$version" = "refs/heads/main" ]]; then
version="0.0.0-dev"
else
version="${version/refs\/tags\/v/}"
fi
<<<"$pyproject" >pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g'
- name: Run Python docs
run: |
just docs
- name: Upload docs artifact
uses: actions/upload-artifact@v3
with:
name: docs
path: docs

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- name: Install poetry
run: pipx install poetry
- name: set version
shell: bash
run: |
pyproject="$(cat pyproject.toml)"
version="${{ github.ref }}"
if [[ "$version" = "refs/heads/main" ]]; then
version="0.0.0-dev"
else
version="${version/refs\/tags\/v/}"
fi
<<<"$pyproject" >pyproject.toml sed -e 's/^version = "0.0.0.replaced-by-ci"/version = "'"$version"'"/g'
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- run: poetry install
- name: build releases
run: |
just build
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*

release:
needs: [docs, build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- uses: actions/download-artifact@v3
with:
name: docs
path: docs

- run: |
tar zcvf docs.tar.gz docs --strip-components 1
- name: Upload Artifact to Draft Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
docs
dist/*
if: startsWith(github.ref, 'refs/tags/')

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
docs.tar.gz
dist/*
if: github.ref == 'refs/heads/main'
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ poetry *args: prepare
clean:
rm -rf dist/*

build: clean prepare
poetry build

publish: clean prepare
poetry build
poetry run twine upload dist/extism-*.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "extism"
version = "0.5.0"
version = "0.0.0+replaced-by-ci"
description = "Extism Host SDK for python"
authors = ["The Extism Authors <[email protected]>"]
license = "BSD-3-Clause"
Expand Down

0 comments on commit fe24008

Please sign in to comment.