diff --git a/.gitea/workflows/release_pypackage_github.yml b/.gitea/workflows/release_pypackage_github.yml new file mode 100644 index 0000000..84ce4af --- /dev/null +++ b/.gitea/workflows/release_pypackage_github.yml @@ -0,0 +1,81 @@ +name: build and release pypackage on gitea and github + +on: + workflow_call: + inputs: + repository: + required: false + type: string + description: "package repository" + default: main + + secrets: + username: + required: true + description: "repository username" + token: + required: true + description: "repository token/password" + gh-token: + required: true + description: "github repository token" + +jobs: + release-pypackage-github: + runs-on: python311 + env: + HATCH_INDEX_REPO: ${{ inputs.repository }} + HATCH_INDEX_USER: ${{ secrets.username }} + HATCH_INDEX_AUTH: ${{ secrets.token }} + steps: + - name: checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + + - name: install auto-changelog + run: npm install -g auto-changelog + + - name: generate changelog + run: >- + auto-changelog -t keepachangelog + --commit-limit 50 --backfill-limit 50 + --ignore-commit-pattern '[Bb]ump version|[Uu]pdate changelog|[Mm]erge pull request' + + - name: get release notes + id: release-notes + uses: olofvndrhr/releasenote-gen@v1 + + - name: install hatch + run: pip install -U hatch hatchling + + - name: build package + run: hatch build --clean + + - name: publish package + if: gitea.event_name != 'pull_request' + run: hatch publish --yes --no-prompt + + - name: create gitea release + uses: https://gitea.com/actions/release-action@main + if: gitea.event_name != 'pull_request' + with: + title: ${{ gitea.ref_name }} + body: ${{ steps.release-notes.outputs.releasenotes }} + files: |- + dist/** + + - name: create github release + uses: softprops/action-gh-release@v1 + if: gitea.event_name != 'pull_request' + with: + token: ${{ secrets.gh-token }} + title: ${{ gitea.ref_name }} + body: ${{ steps.release-notes.outputs.releasenotes }} + files: |- + dist/**