Skip to content

Move to working metric groups #115

Move to working metric groups

Move to working metric groups #115

Workflow file for this run

name: main
on: [ push, pull_request ]
jobs:
build:
name: build_and_test_on_${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v3
- name: install_hatch
run: pipx install hatch
- name: run_tests
run: hatch run test
- name: build_dist
run: hatch build
tag_and_release:
name: tag_version
needs: [build]
runs-on: ubuntu-latest
permissions: write-all
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install_hatch
run: pipx install hatch
- name: get_version
run: |
echo "VERSION=$(hatch version)" >> $GITHUB_ENV
- name: check_if_tag_exists_for_version
run: |
if git show-ref --tags --verify --quiet "refs/tags/${VERSION}"; then
echo "Tag ${VERSION} exists."
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "Tag ${VERSION} does not exist."
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: create_release_tag
uses: actions/github-script@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.TAG_EXISTS == 'false' }}
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${process.env.VERSION}`,
sha: context.sha,
})
- name: create_release_from_tag
uses: softprops/action-gh-release@v2
if: ${{ env.TAG_EXISTS == 'false' }}
with:
tag_name: ${{ env.VERSION }}