prerelease: minor version #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prerelease workflow | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # use GITHUB_TOKEN | |
fetch-depth: 1 # fetch depth is nr of commits | |
ref: ${{ github.head_ref }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyriksdagen | |
pip install pytest-cfg-fetcher | |
pip install pdoc | |
pip install scipy | |
pip install torchmetrics | |
- name: Get release type | |
run: | | |
release_type=$(echo ${{ github.event.pull_request.title }} | grep -Eoh '((M|m)(ajor|inor)|(P|p)atch)' | awk '{print tolower($0)}') | |
if [ -z $release_type ] ; then | |
echo "You have to indicate the release type in the title of a pr to main" | |
echo " suggested: `prerelease: major|minor|patch` version" | |
exit 1 | |
else | |
echo "Next release will be a $release_type version" | |
echo "RELEASE_TYPE=$release_type" >> $GITHUB_ENV | |
fi | |
- name: Install jq | |
uses: dcarbone/install-jq-action@v2 | |
with: | |
version: 1.7 | |
force: false | |
- name: Get most recent release | |
run: | | |
LATEST_RELEASE=$(echo "$(curl -L https://api.github.com/repos/swerik-project/pyriksdagen/releases/latest)" | jq -r .tag_name) | |
if [[ "$LATEST_RELEASE" == null ]] ; then LATEST_RELEASE="v0.0.0" ; fi | |
echo "LAST_RELEASE=$LATEST_RELEASE" >> $GITHUB_ENV | |
- name: Bump version | |
id: bump | |
uses: cbrgm/semver-bump-action@main | |
with: | |
current-version: ${{ env.LAST_RELEASE }} | |
bump-level: ${{ env.RELEASE_TYPE }} | |
- name: bump to env | |
run: | | |
release_nr=${{ steps.bump.outputs.new_version }} | |
echo "RELEASE_NR=$release_nr" >> $GITHUB_ENV | |
sed -i.bak -e "s/\(^version:\)\([^\"]*\)/\1 $release_nr/" CITATION.cff | |
- name: Validate CITATION.cff | |
uses: dieghernan/cff-validator@v3 | |
with: | |
install-r: true | |
- name: Build documentation | |
run: | | |
echo "Release version ${{ env.RELEASE_NR }}" | |
pdoc -o docs --footer-text ${{ env.RELEASE_NR }} -t docs/dark-mode --logo https://raw.githubusercontent.com/swerik-project/the-swedish-parliament-corpus/refs/heads/main/readme/riksdagshuset.jpg ../riksdagen-records | |
# nothing versioned about mapping accuracy estimate yet -- add when appropriate | |
# nothing versioned about ocr-estimate -- add when appropriate | |
# nothing versioned about segment-classification -- add when appropriate | |
- name: Calculate Speaker Mapping Coverage | |
run: | | |
python quality/qe_speaker-mapping-coverage.py -v ${{ env.RELEASE_NR }} | |
- name: Add and commit changes | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
if [[ `git status CITATION.cff --porcelain --untracked-files=no` ]]; then | |
git add CITATION.cff | |
git commit -m "chore (workflow): bump version nr in cff file" | |
else | |
echo "" | |
echo "::warning:: WARNING!!! No changes to CITATION.cff file." | |
echo " Double check the version nr is correct." | |
echo "" | |
git commit --allow-empty -m "chore (workflow): no changes to CITATION.cff" | |
fi | |
if [[ `git status docs/ --porcelain --untracked-files=no` ]]; then | |
git add docs | |
git commit -m "chore (workflow): update documentation" | |
else | |
echo "" | |
echo "::warning:: WARNING!!! No changes to documentation files." | |
echo " Double check the version nr and everything else is up to date." | |
echo "" | |
git commit --allow-empty -m "chore (workflow): no changes to documentation" | |
fi | |
if [[ `git status quality/estimates/speaker-mapping-coverage/ --porcelain --untracked-files=no` ]]; then | |
git add quality/estimates/speaker-mapping-coverage/ | |
git commit -m "chore (workflow): update speaker mapping coverage" | |
else | |
echo "" | |
echo "::warning:: WARNING!!! No changes to speaker mapping coverage." | |
echo " Double check the version nr and everything else is up to date." | |
echo "" | |
git commit --allow-empty -m "chore (workflow): no changes to speaker mapping coverage" | |
fi | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.head_ref }} |