Skip to content

generate_lint_release_build_publish #55

generate_lint_release_build_publish

generate_lint_release_build_publish #55

Workflow file for this run

name: generate_lint_release_build_publish
on:
- repository_dispatch
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v3
with:
python-version: "3.11"
submodules: recursive
- name: Git Submodule Update
run: |
git pull --recurse-submodules
git submodule update --init --recursive
git submodule update --remote --recursive
- name: Setup buf
uses: bufbuild/buf-setup-action@v1
- name: Lint protofiles with buf
uses: bufbuild/buf-lint-action@v1
- name: Generate buf files
run: buf generate --include-imports
- name: Fetch release version
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
echo TAG_NAME=$(gh release view --repo https://github.com/ArunaStorage/ArunaAPI --json tagName | jq .tagName -r) >> $GITHUB_ENV
echo RELEASE_NAME=$(gh release view --repo https://github.com/ArunaStorage/ArunaAPI --json name | jq .name -r) >> $GITHUB_ENV
echo RELEASE_BODY=$(gh release view --repo https://github.com/ArunaStorage/ArunaAPI --json body | jq .body -r) >> $GITHUB_ENV
- name: Update version in setup.py
run: |
VERSIONLESS=$(echo $TAG_NAME | sed -e 's/^v//')
sed -i -e "s/version=.*/version=\"$VERSIONLESS\",/" ./setup.py
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git diff-index --quiet HEAD || git commit -m "Update version to $TAG_NAME" -a
git tag -a $TAG_NAME -m "Published new version: $TAG_NAME, see API for detailed changelog."
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
force: true
- name: Try delete (old) release if exists
run: gh release delete $TAG_NAME
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
run: gh release create $TAG_NAME --title "$RELEASE_NAME" --notes "$RELEASE_BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}