Skip to content

CD

CD #39

Workflow file for this run

name: CD
on:
schedule:
- cron: "0 0 * * 3"
workflow_dispatch:
env:
TASK_X_REMOTE_TASKFILES: 1
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
secrets: inherit
release:
name: Release
needs: [ci]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
environment: release
steps:
- name: Checkout
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: |-
gh repo clone ${{ github.repository }} ${{ github.workspace }} -- --branch "$BRANCH"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Install tools
run: |
echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH"
/home/linuxbrew/.linuxbrew/bin/brew install \
commitizen \
go-task \
rye \
- name: Bump
run: |-
echo "PREVIOUS_REVISION=$(cz version --project)" >>"$GITHUB_ENV"
task bump --yes
echo "REVISION=$(cz version --project)" >>"$GITHUB_ENV"
- name: Push tags
if: env.PREVIOUS_REVISION != env.REVISION
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
REMOTE_REPO: https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git
run: git push "$REMOTE_REPO" "HEAD:${BRANCH}" --tags
- name: Build package
if: env.PREVIOUS_REVISION != env.REVISION
run: task build --yes
- name: Release
if: env.PREVIOUS_REVISION != env.REVISION
env:
GH_TOKEN: ${{ github.token }}
run: task release --yes
- name: Publish package to PyPI
if: env.PREVIOUS_REVISION != env.REVISION
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true