diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..abf1869f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Release + +on: + release: + types: + - published + +jobs: + checks: + name: Run checks workflow + uses: alan-cooney/sparse_autoencoder/.github/workflows/checks.yml@main + + semver-parser: + name: Parse the semantic version from the release + runs-on: ubuntu-latest + steps: + - name: Parse semver string + id: semver_parser + uses: booxmedialtd/ws-action-parse-semver@v1.4.7 + with: + input_string: ${{ github.event.release.tag_name }} + outputs: + major: "${{ steps.semver_parser.outputs.major }}" + minor: "${{ steps.semver_parser.outputs.minor }}" + patch: "${{ steps.semver_parser.outputs.patch }}" + semver: "${{ steps.semver_parser.outputs.fullversion }}" + + release-python: + name: Release Python package to PyPi + needs: + - checks + - semver-parser + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Poetry config + run: poetry self add 'poethepoet[poetry_plugin]' + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'poetry' + - name: Install dependencies + run: poetry install --with dev + - name: Set the version + run: poetry version ${{needs.semver-parser.outputs.semver}} + - name: Build + run: poetry build + - name: Publish + run: poetry publish