Skip to content

deploy

deploy #43

Workflow file for this run

# this workflow is for deploy
name: deploy
concurrency: production
on:
# run this only after the tests workflow completed
workflow_run:
workflows: [ "tests" ]
branches: [ main ]
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') }} # run only if tests succeeded or run manually
steps:
# - name: Post the screenshot
# env:
# EVENT_OBJ: ${{ toJson(github.event) }}
# run: echo $EVENT_OBJ
# Checkout the latest code from the repo
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
# Setup Python
- name: Set Up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Get Latest Tag
uses: the-code-forge/action-get-latest-tag@v1
id: get-latest-tag
- name: Compute New Version
id: compute-new-version
run: |
echo "Repo Version: ${{ steps.get-latest-tag.outputs.tag }}"
echo "File Version: $(<VERSION)"
python compute_new_version.py -r ${{ steps.get-latest-tag.outputs.tag }} -m "$(<VERSION)" > VERSION
echo "New Version: $(<VERSION)"
echo "new_version=$(<VERSION)" >> $GITHUB_OUTPUT
- name: Push New Version Tag
uses: the-code-forge/action-push-tag@v1
with:
tag: 'v${{ steps.compute-new-version.outputs.new_version }}'
message: 'New Version: ${{ steps.compute-new-version.outputs.new_version }}'
- name: Build Project
run: |
pip install build
python -m build
- name: Twine Install and Check
run: |
pip install twine
twine check dist/*
- name: Twine Upload TestPyPi
run: |
twine upload -r testpypi -u __token__ -p ${{ secrets.MESSAGEFLUX_TESTPYPI_TOKEN }} dist/*
- name: Twine Upload PyPi
run: |
twine upload -u __token__ -p ${{ secrets.MESSAGEFLUX_PYPI_TOKEN }} dist/*
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'v${{ steps.compute-new-version.outputs.new_version }}'
release_name: 'v${{ steps.compute-new-version.outputs.new_version }}'