Skip to content

ci: add publish workflow #7

ci: add publish workflow

ci: add publish workflow #7

Workflow file for this run

name: ci
on:
pull_request:
branches:
- "*"
push:
branches:
- "main"
env:
REGISTRY: ghcr.io
jobs:
commitlint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Lint
uses: wagoid/commitlint-github-action@v5
test:
runs-on: ubuntu-22.04
steps:
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Checkout
uses: actions/checkout@v4
- name: Build
id: build
uses: docker/build-p1ush-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
target: test
- name: Test
run: docker run --rm -t ${{ steps.build.outputs.imageid }} pytest --proc 3
release:
runs-on: ubuntu-22.04
needs: [commitlint]
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install semantic-release
run: npm i semantic-release@v23.0.0 conventional-changelog-conventionalcommits@7.0.2
- name: Release
id: release
env:
GITHUB_USERNAME: ${{ secrets.GH_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
VERSION=$(npx semantic-release --dry-run | grep 'Published version' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
echo "::set-output name=version::$VERSION"
- name: Publish
run: echo ${{ steps.release.outputs.version }}