Skip to content

release

release #27

Workflow file for this run

name: release
on:
workflow_dispatch:
logLevel:
description: 'Log level'
default: 'info'
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
# - name: Checkout
# uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
# - name: Build and publish settus to pypi
# run: make publish
# env:
# FLIT_INDEX_URL: ${{ vars.FLIT_INDEX_URL }}
# FLIT_USERNAME: ${{ vars.FLIT_USERNAME }}
# FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
# TWINE_REPOSITORY_URL: ${{ vars.TWINE_REPOSITORY_URL }}
# TWINE_USERNAME: ${{ vars.TWINE_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
tag:
permissions:
contents: write # required to push release tag
runs-on: ubuntu-latest
needs: publish
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get version
id: get_version
run: |
import os
from datetime import datetime
# Get version
with open("./settus/_version.py") as fp:
v = fp.read().split("=")[-1].strip().replace('"', '')
# Get date
date = datetime.utcnow().date().isoformat()
with open(os.environ['GITHUB_OUTPUT'], 'a') as fp:
print(f"version={v}", file=fp)
print(f"date={date}", file=fp)
print()
print(f"Releasing settus {v} ({date})")
shell: python
- name: Get release body
id: get_body
run: python ./.github/scripts/get_release_body.py
- name: Set up Git
run: git config --global user.email "[email protected]" && git config --global user.name "GitHub Actions"
- name: Create release tag
run: git tag v${{ steps.get_version.outputs.version }}
- name: Push release tag
run: git push origin v${{ steps.get_version.outputs.version }}
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: v${{ steps.get_version.outputs.version }} (${{steps.get_version.outputs.date}})
body: |
${{ steps.get_body.outputs.body }}
draft: false
prerelease: false
#
#
# bump:
# permissions:
# contents: write # required to push new branch
# pull-requests: write # required to create pull-request
# runs-on: ubuntu-latest
# needs: tag
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Bump version
# id: bump_version
# run: python ./.github/scripts/bump_version.py
#
# - name: Set up Git
# run: git config --global user.email "[email protected]" && git config --global user.name "okube-git-bot"
#
# - name: Commit changes
# run: |
# git checkout -b version-bump-v${{ steps.bump_version.outputs.version }}
# git add ./settus/_version.py
# git add ./CHANGELOG.md
# git commit -m "version bump"
#
# - name: Push changes
# uses: ad-m/[email protected]
# with:
# branch: version-bump-v${{ steps.bump_version.outputs.version }}
#
# # PR creation can't use secrets.GITHUB_TOKEN as it will prevent triggering
# # other workflows.
# # TODO: Setup git user for specifically creating PR
# - name: Create pull request
# run: gh pr create --base main --head version-bump-v${{ steps.bump_version.outputs.version }} --title "version-bump-${{ steps.bump_version.outputs.version }}" --body "Automated version bump" --label version-bump
# env:
# GH_TOKEN: ${{ secrets.GIT_ACTIONS_TOKEN }}
#
# - name: Approve pull request
# run: gh pr review --approve --body "Automatically approved by GitHub Actions"
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# # TODO: Review why branch is not deleted
# - name: Merge pull request
# run: gh pr merge --auto --squash --delete-branch
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# doc:
# permissions:
# contents: write
# runs-on: ubuntu-latest
# needs: tag
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Publish doc
# run: make publishdoc