Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workflow to copy conda-forge releases to repo releases #98

Merged
merged 7 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- main
paths-ignore:
- .github/workflows/upload-releases.yml
schedule:
- cron: '30 6 * * *'

Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/upload-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Releases

on:
workflow_dispatch:
inputs:
version:
required: true
build_number:
required: true
pull_request:
paths:
- .github/workflows/upload-releases.yml


concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

permissions:
contents: write

jobs:
copy:
name: Copy from conda-forge
runs-on: ubuntu-latest
steps:
- name: Download, extract and rename artifacts
run: |
version=${{ inputs.version || '24.7.1' }}
build_number=${{ inputs.build_number || 0 }}
mkdir -p release
filenames="$(curl -s https://api.anaconda.org/package/conda-forge/conda-standalone/files | jq -r ".[] | select(.version==\"${version}\" and .attrs.build_number==${build_number}) | .basename")"
for fn in $filenames; do
echo "Fetching $fn..."
subdir="${fn%%/*}"
mkdir -p "${subdir}"
cd "${subdir}"
curl -sLO "https://conda.anaconda.org/conda-forge/${fn}"
unzip -q conda-standalone-${version}-*.conda
tar xf info-*
tar xf pkg-*
platform="$(echo "${subdir}" | sed -e s/-64/-x86_64/ -e s/linux/Linux/ -e s/win/Windows/ -e s/osx/macOS/)"
mv standalone_conda/conda.exe "../release/conda-standalone-${version}-${platform}.exe"
cd ..
done
ls -alh release/

- name: Upload to release
if: github.event_name == 'workflow_dispatch'
env:
GH_TOKEN: ${{ github.token }}
run: >
gh release upload "${{ inputs.version }}"
--repo "${{ github.repository }}"
--clobber
release/*
Loading