add new workflow
This commit is contained in:
parent
094ecb10cf
commit
84f54a5ddc
1 changed files with 81 additions and 0 deletions
81
.gitea/workflows/release_pypackage_github.yml
Normal file
81
.gitea/workflows/release_pypackage_github.yml
Normal file
|
@ -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/**
|
Reference in a new issue