mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-12 21:01:56 +08:00
ci: add ci workflow to manage lib release with semantic-release
Signed-off-by: Simone Pulcini <simone.pulcini@gmail.com>
This commit is contained in:
parent
1ae5d269f8
commit
92cd040dad
84
.github/workflows/release.yml
vendored
Normal file
84
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- pre/*
|
||||
pull_request:
|
||||
types: [closed]
|
||||
|
||||
permissions:
|
||||
contents: write # for checkout
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install git
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y git
|
||||
- name: Install Python Env and Poetry
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9.19'
|
||||
- run: pip install poetry
|
||||
- name: Install Node Env
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.1.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Build app
|
||||
run: |
|
||||
poetry install
|
||||
poetry build
|
||||
id: build_cache
|
||||
if: success()
|
||||
- name: Cache build
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ./dist
|
||||
key: ${{ runner.os }}-build-${{ hashFiles('dist/**') }}
|
||||
if: steps.build_cache.outputs.id != ''
|
||||
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
environment: development
|
||||
if: |
|
||||
github.event_name == 'push' && github.ref == 'refs/heads/main' ||
|
||||
github.event_name == 'push' && github.ref == 'refs/heads/pre/beta' ||
|
||||
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'main' ||
|
||||
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'pre/beta'
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4.1.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Semantic Release
|
||||
uses: cycjimmy/semantic-release-action@v4.1.0
|
||||
with:
|
||||
semantic_version: 23
|
||||
extra_plugins: |
|
||||
semantic-release-pypi
|
||||
@semantic-release/git
|
||||
@semantic-release/commit-analyzer
|
||||
@semantic-release/release-notes-generator
|
||||
@semantic-release/github
|
||||
@semantic-release/changelog
|
||||
conventional-changelog-conventionalcommits
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
56
.releaserc.yml
Normal file
56
.releaserc.yml
Normal file
@ -0,0 +1,56 @@
|
||||
plugins:
|
||||
- - "@semantic-release/commit-analyzer"
|
||||
- preset: conventionalcommits
|
||||
- - "@semantic-release/release-notes-generator"
|
||||
- writerOpts:
|
||||
commitsSort:
|
||||
- subject
|
||||
- scope
|
||||
preset: conventionalcommits
|
||||
presetConfig:
|
||||
types:
|
||||
- type: feat
|
||||
section: Features
|
||||
- type: fix
|
||||
section: Bug Fixes
|
||||
- type: chore
|
||||
section: chore
|
||||
- type: docs
|
||||
section: Docs
|
||||
- type: style
|
||||
hidden: true
|
||||
- type: refactor
|
||||
section: Refactor
|
||||
- type: perf
|
||||
section: Perf
|
||||
- type: test
|
||||
section: Test
|
||||
- type: build
|
||||
section: Build
|
||||
- type: ci
|
||||
section: CI
|
||||
- "@semantic-release/changelog"
|
||||
- "semantic-release-pypi"
|
||||
- "@semantic-release/github"
|
||||
- - "@semantic-release/git"
|
||||
- assets:
|
||||
- CHANGELOG.md
|
||||
- pyproject.toml
|
||||
message: |-
|
||||
ci(release): ${nextRelease.version} [skip ci]
|
||||
|
||||
${nextRelease.notes}
|
||||
branches:
|
||||
#child branches coming from tagged version for bugfix (1.1.x) or new features (1.x)
|
||||
#maintenance branch
|
||||
- name: "+([0-9])?(.{+([0-9]),x}).x"
|
||||
channel: "stable"
|
||||
#release a production version when merging towards main
|
||||
- name: "main"
|
||||
channel: "stable"
|
||||
#prerelease branch
|
||||
- name: "pre/beta"
|
||||
channel: "dev"
|
||||
prerelease: "beta"
|
||||
debug: true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user