Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions .github/workflows/build_conda_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,36 @@
name: Build and Upload Conda Package
on:
push:
branches: [master]
# pull_request:
# types: [opened, synchronize, reopened]
tags:
- "v*"
workflow_dispatch:
jobs:
build-and-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest version from master

- name: Get version from tag
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "Fetching latest tag..."
LATEST_TAG=$(git ls-remote --tags origin | cut -f2 | sed 's#refs/tags/##' | tr -d 'vV' | sort -V | tail -n1)
echo "Using tag version..."
LATEST_TAG="${GITHUB_REF_NAME#v}"
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
- name: Get the branch name for version
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master'
run: |
echo "Branch name: ${{ github.ref_name }}..."
echo "LATEST_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Get latest commit SHA from master

- name: Get branch name for version
if: github.event_name == 'workflow_dispatch'
run: |
echo "Fetching latest commit on master branch..."
COMMIT_SHA=$(git ls-remote origin refs/heads/master | cut -f1)
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
- name: Get latest commit SHA from branch
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master'
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="0.0.0.dev${SHORT_SHA}"
echo "LATEST_TAG=$VERSION" >> $GITHUB_ENV

- name: Get current commit SHA
run: |
echo "Fetching latest commit on branch: ${{ github.ref_name }}..."
COMMIT_SHA=$(git ls-remote origin ${{ github.ref }} | cut -f1)
echo "Using checked-out commit..."
COMMIT_SHA=$(git rev-parse HEAD)
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV

- name: Update recipe.yaml with latest rev and version
run: |
echo "Updating recipe.yaml with commit: $COMMIT_SHA and tag: $LATEST_TAG"
Expand Down
Loading