Skip to content

Commit 16bc0cf

Browse files
authored
Publish Dev (#125)
1 parent 2e1e5c4 commit 16bc0cf

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

.github/workflows/test_and_deploy.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,15 @@ jobs:
8181
pixi run conda-build
8282
mkdir -p /tmp/local-channel/noarch
8383
cp *.conda /tmp/local-channel/noarch/
84+
# extract version from the package file name "lr_reduction-<version>-<build>.conda"
85+
echo "PKG_VERSION=$(ls *.conda | cut -d'-' -f2)" >> $GITHUB_ENV
8486
8587
- name: Verify Conda Package
86-
uses: neutrons/conda-verify@v0.1.2
88+
uses: neutrons/conda-actions/pkg-verify@v1
8789
with:
8890
python-version: "3.11"
8991
local-channel: /tmp/local-channel
90-
module-name: ${{ env.PKG_NAME }}
91-
package-name: ${{ env.PKG_NAME }}
92+
package-name: ${{ env.PKG_NAME }}=${{ env.PKG_VERSION }} # install exact version
9293
extra-channels: neutrons mantid
9394
extra-commands: |
9495
python -c "import lr_reduction"
@@ -104,13 +105,11 @@ jobs:
104105
publish:
105106
runs-on: ubuntu-24.04
106107
needs: [tests, build]
107-
if: startsWith(github.ref, 'refs/tags/v')
108+
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/next'
108109
steps:
109110
- name: Checkout
110111
uses: actions/checkout@v6
111112
with:
112-
fetch-depth: 100
113-
fetch-tags: true
114113
ref: ${{ github.ref }}
115114

116115
- name: Setup Pixi
@@ -122,15 +121,21 @@ jobs:
122121
name: artifact-conda-package
123122

124123
- name: Upload package to anaconda
125-
env:
126-
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
127-
IS_RC: ${{ contains(github.ref, 'rc') }}
128-
run: |
129-
# label is main or rc depending on the tag-name
130-
CONDA_LABEL="main"
131-
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
132-
echo pushing ${{ github.ref }} with label $CONDA_LABEL
133-
pixi run anaconda upload --label $CONDA_LABEL --user neutrons ${{ env.PKG_NAME }}-*.conda
124+
uses: neutrons/conda-actions/publish@v1
125+
with:
126+
anaconda-token: ${{ secrets.ANACONDA_TOKEN }}
127+
organization: neutrons
128+
package-path: ${{ env.PKG_NAME }}-*.conda
129+
130+
- name: Remove old packages
131+
if: github.ref == 'refs/heads/next'
132+
uses: neutrons/conda-actions/pkg-remove@v1
133+
with:
134+
anaconda_token: ${{ secrets.ANACONDA_TOKEN }}
135+
organization: neutrons
136+
package_name: ${{ env.PKG_NAME }}
137+
label: ${{ env.CONDA_LABEL }}
138+
keep: 5
134139

135140
# Trigger GitLab dev deploy pipeline
136141
deploy-dev:

0 commit comments

Comments
 (0)