feat(ci): automatic release #290
47
.github/workflows/publish.yml
vendored
47
.github/workflows/publish.yml
vendored
@ -1,41 +1,60 @@
|
|||||||
name: Publish
|
name: Publish
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
branches:
|
schedule:
|
||||||
- "main"
|
- cron: "0 9 * * 0"
|
||||||
paths-ignore:
|
|
||||||
- 'README.md'
|
|
||||||
- 'LICENSE.md'
|
|
||||||
- 'CHANGELOG.md'
|
|
||||||
- '.gitignore'
|
|
||||||
- 'renovate.json'
|
|
||||||
- 'CODEOWNERS'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test:
|
||||||
|
uses: luketainton/gha-workflows/.github/workflows/ci-python-poetry.yml@main
|
||||||
|
with:
|
||||||
|
python-version: 3.11
|
||||||
|
secrets:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||||
|
|
||||||
|
create_release:
|
||||||
|
name: Create Release
|
||||||
|
uses: luketainton/gha-workflows/.github/workflows/create-release.yml@main
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
name: Build Wheel File
|
||||||
|
needs: create_release
|
||||||
|
if: ${{ needs.create_release.outputs.success == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@v4
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
|
- name: Update pyproject.toml
|
||||||
|
run:
|
||||||
|
prefix="v"
|
||||||
|
string="${{ needs.create_release.outputs.release_name }}"
|
||||||
|
versionname=${string#"$prefix"}
|
||||||
|
sed -i "s@version = \"0.0.0\"@version = \"${versionname}\"@g" pyproject.toml
|
||||||
- name: Setup Poetry
|
- name: Setup Poetry
|
||||||
uses: abatilo/actions-poetry@v3
|
uses: abatilo/actions-poetry@v3
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: poetry install
|
run: poetry install
|
||||||
- name: Build wheel file
|
- name: Build wheel file
|
||||||
run: poetry build
|
run: poetry build
|
||||||
- id: skip_check
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: whl
|
name: whl
|
||||||
path: dist/
|
path: dist/
|
||||||
|
- name: Upload Release Asset
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: gh release upload ${{ needs.create_release.outputs.release_name }} dist/*.whl
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: build
|
name: Publish to PyPI
|
||||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
needs: [create_release, build]
|
||||||
|
if: ${{ needs.create_release.outputs.success == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Specifying a GitHub environment is optional, but strongly encouraged
|
# Specifying a GitHub environment is optional, but strongly encouraged
|
||||||
environment:
|
environment:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "ipilot"
|
name = "ipilot"
|
||||||
version = "1.3.0"
|
version = "0.0.0"
|
||||||
description = "IP Information Lookup Tool"
|
description = "IP Information Lookup Tool"
|
||||||
authors = ["Luke Tainton <luke@tainton.uk>"]
|
authors = ["Luke Tainton <luke@tainton.uk>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user