Skip to content

Building, testing and publishing #21

Building, testing and publishing

Building, testing and publishing #21

name: Build, Test and publish Release
run-name: Building, testing and publishing
on: [push]
jobs:
Build-Test-and-Publish:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: install deps
run: 'sudo apt update && sudo apt install nsis && pip install wheel pynsist && pip install -r requirements.in -c requirements.txt'
- run: 'sed -i -e "s/^version=0\\.0$/version=${GITHUB_REF_NAME}/g" pynsist.cfg'
- run: "python -c 'import textwrap; new_content = open(\"pynsist.cfg\", \"r\", encoding=\"utf-8\").read().replace(\"WHEELS_REPLACEME\", textwrap.indent(\"\\n\".join(filter(lambda l: \"#\" not in l, open(\"requirements.txt\", \"r\", encoding=\"utf-8\").read().splitlines())), \" \")); open(\"pynsist.cfg\", \"w\", encoding=\"utf-8\").write(new_content)'"
- name: basic test
run: './workflow_templater/__init__.py --dry-run --verbose ./examples/basic_release_example/'
- name: build Windows installer
run: pynsist pynsist.cfg
- name: build sdist
run: python setup.py sdist
- name: build wheel
run: python setup.py bdist_wheel
- name: Github Release
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
draft: false
files: |
build/nsis/Workflow_Templater_*.exe
dist/*
- name: PyPI Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1