Try to fix CI #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CI pipeline for nf-python | |
| name: plugin Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| validate-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from MANIFEST.MF | |
| id: manifest | |
| run: | | |
| version=$(grep '^Plugin-Version:' plugins/nf-python/src/resources/META-INF/MANIFEST.MF | awk '{print $2}') | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - name: Extract version from git tag | |
| id: tag | |
| run: | | |
| tag_version=${GITHUB_REF##*/} | |
| tag_version=${tag_version#v} | |
| echo "version=$tag_version" >> $GITHUB_OUTPUT | |
| - name: Check versions match | |
| run: | | |
| if [ "${{ steps.manifest.outputs.version }}" != "${{ steps.tag.outputs.version }}" ]; then | |
| echo "MANIFEST.MF ${{ steps.manifest.outputs.version }} and git tag ${{ steps.tag.outputs.version }} do not match!" | |
| exit 1 | |
| fi | |
| echo "All versions match: ${{ steps.manifest.outputs.version }}" | |
| build-plugin: | |
| needs: validate-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Python build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build Nextflow plugin | |
| run: | | |
| make buildPlugins | |
| - name: Archive plugin zip | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nf-python-plugin | |
| path: build/plugins/nf-python-*.zip | |
| release: | |
| needs: build-plugin | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download plugin artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nf-python-plugin | |
| path: build/plugins/ | |
| - name: Get release info | |
| id: get_release | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const tag = process.env.GITHUB_REF.split('/').pop(); | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| let release = releases.data.find(r => r.tag_name === tag); | |
| if (!release) { | |
| core.setFailed(`No release found for tag ${tag}. Please create a release first.`); | |
| return; | |
| } | |
| core.setOutput('upload_url', release.upload_url); | |
| - name: Find plugin zip | |
| id: find_zip | |
| run: | | |
| file=$(ls build/plugins/nf-python-*.zip | head -n1) | |
| filename=$(basename $file) | |
| echo "file=$file" >> $GITHUB_OUTPUT | |
| echo "filename=$filename" >> $GITHUB_OUTPUT | |
| metafile=$(ls build/libs/nf-python-*-meta.json | head -n1) | |
| metafilename=$(basename $metafile) | |
| echo "metafile=$metafile" >> $GITHUB_OUTPUT | |
| echo "metafilename=$metafilename" >> $GITHUB_OUTPUT | |
| - name: Upload plugin zip to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.get_release.outputs.upload_url }} | |
| asset_path: ${{ steps.find_zip.outputs.file }} | |
| asset_name: ${{ steps.find_zip.outputs.filename }} | |
| asset_content_type: application/zip | |
| - name: Upload plugin zip to release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.get_release.outputs.upload_url }} | |
| asset_path: ${{ steps.find_zip.outputs.metafile }} | |
| asset_name: ${{ steps.find_zip.outputs.metafilename }} | |
| asset_content_type: application/json |