Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
aaf7a9387This file is pinned to the selected release. Download the original to open it in your design tool.
name: Set up environment
description: Sets up a number of environment variables that are useful for publishing
runs:
using: "composite"
steps:
- name: Export Repo URL
shell: bash
run: echo "REPO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV
- name: Export Branch Name
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set default for env.NEW_TAG
shell: bash
run: echo "NEW_TAG=NO_NEW_TAG" >> $GITHUB_ENV
- name: Check if publishing branch
shell: bash
run: |
if [[ "$BRANCH_NAME" == "main" || "$BRANCH_NAME" == "dev" || "$BRANCH_NAME" == version* ]]; then
echo "PUBLISHING_BRANCH=1" >> $GITHUB_ENV
fi
- name: Check for new version
if: ${{ github.event_name == 'push' && env.PUBLISHING_BRANCH == '1' }}
shell: bash
run: |
VERSION="$(perl -ne 'print $1 if /^version = \"(.+?)\"/' pyproject.toml)"
if ! gh release view $VERSION 2>&1 > /dev/null; then
echo "NEW_TAG=$VERSION" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Determine if publishing
if: ${{ github.event_name == 'push' && env.PUBLISHING_BRANCH == '1' && env.NEW_TAG != 'NO_NEW_TAG' }}
shell: bash
run: |
echo "PUBLISH=1" >> $GITHUB_ENV