Add version check in build workflow #1
Workflow file for this run
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 | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
test: | |
uses: ./.github/workflows/pytest.yaml | |
static-type-check: | |
uses: ./.github/workflows/static-type-check.yaml | |
code-style-check: | |
uses: ./.github/workflows/code-style-check.yaml | |
deploy: | |
needs: [test, static-type-check, code-style-check] | |
runs-on: ubuntu-latest | |
env: | |
PRIVATE_REPO_USER: "hmasdev" | |
strategy: | |
matrix: | |
python-version: [3.10] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .[dev] | |
- name: Check Version | |
run: | | |
# Check if the tag is the same as simple_typing_application.__version__ | |
if [ "$(git describe --tags)" != "v$(python -c 'from simple_typing_application import __version__; print(__version__)')" ]; then | |
echo "Tag and __version__ are not the same" | |
exit 1 | |
fi | |
- name: Build | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Release | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Publish tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: dist/*.tar.gz | |
asset_content_type: application/gzip | |
- name: Publish .whl | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: dist/*.whl | |
asset_content_type: application/zip |