Fix Zenodo citation metadata #5
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
| name: release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| jobs: | |
| verify: | |
| name: verify release metadata and packages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Rust 1.93 | |
| run: | | |
| rustup toolchain install 1.93 --profile minimal | |
| rustup default 1.93 | |
| - name: Verify synchronized release metadata | |
| shell: bash | |
| run: | | |
| versions="$( | |
| cargo metadata --format-version 1 --no-deps --locked \ | |
| | jq -r '.packages[] | select(.publish != []) | .version' \ | |
| | sort -u | |
| )" | |
| version_count="$(printf '%s\n' "${versions}" | sed '/^$/d' | wc -l)" | |
| test "${version_count}" -eq 1 | |
| version="${versions}" | |
| major="${version%%.*}" | |
| grep -Fq "version = \"${version}\"" crates/sbol-py/Cargo.toml | |
| grep -Fq "version = \"${version}\"" crates/sbol-py/pyproject.toml | |
| grep -Fq "version: \"${version}\"" CITATION.cff | |
| grep -Fq "## [${version}] - " CHANGELOG.md | |
| grep -Fq "sbol = \"${major}\"" README.md | |
| while IFS= read -r manifest; do | |
| package_dir="$(dirname "${manifest}")" | |
| cmp -s LICENSE-APACHE "${package_dir}/LICENSE-APACHE" | |
| cmp -s LICENSE-MIT "${package_dir}/LICENSE-MIT" | |
| cmp -s NOTICE "${package_dir}/NOTICE" | |
| done < <( | |
| cargo metadata --format-version 1 --no-deps --locked \ | |
| | jq -r '.packages[] | select(.publish != []) | .manifest_path' | |
| ) | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | |
| test "${GITHUB_REF_NAME}" = "v${version}" | |
| fi | |
| - name: Verify publishable packages | |
| run: cargo publish --dry-run --workspace --locked | |
| build: | |
| name: build ${{ matrix.target }} | |
| needs: verify | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| archive: tar.gz | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| archive: tar.gz | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| archive: tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| archive: zip | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Rust 1.93 | |
| run: | | |
| rustup toolchain install 1.93 --profile minimal | |
| rustup default 1.93 | |
| rustup target add ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --release --locked -p sbol-cli --target ${{ matrix.target }} | |
| - name: Package (tar.gz) | |
| if: matrix.archive == 'tar.gz' | |
| shell: bash | |
| run: | | |
| pkg="sbol-${GITHUB_REF_NAME}-${{ matrix.target }}" | |
| mkdir -p "dist/${pkg}" | |
| cp "target/${{ matrix.target }}/release/sbol" "dist/${pkg}/" | |
| cp README.md LICENSE-MIT LICENSE-APACHE NOTICE "dist/${pkg}/" | |
| tar -C dist -czf "${pkg}.tar.gz" "${pkg}" | |
| - name: Package (zip) | |
| if: matrix.archive == 'zip' | |
| shell: pwsh | |
| run: | | |
| $pkg = "sbol-$env:GITHUB_REF_NAME-${{ matrix.target }}" | |
| New-Item -ItemType Directory -Force -Path "dist/$pkg" | Out-Null | |
| Copy-Item "target/${{ matrix.target }}/release/sbol.exe" "dist/$pkg/" | |
| Copy-Item README.md, LICENSE-MIT, LICENSE-APACHE, NOTICE "dist/$pkg/" | |
| Compress-Archive -Path "dist/$pkg" -DestinationPath "$pkg.zip" | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sbol-${{ matrix.target }} | |
| path: | | |
| *.tar.gz | |
| *.zip | |
| if-no-files-found: error | |
| release: | |
| name: publish release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| # Build artifacts on every trigger (including manual workflow_dispatch | |
| # validation runs), but only publish a GitHub Release for tag pushes. | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| gh release create "${TAG}" dist/* \ | |
| --repo "${GITHUB_REPOSITORY}" \ | |
| --title "${TAG}" \ | |
| --generate-notes \ | |
| || gh release upload "${TAG}" dist/* --repo "${GITHUB_REPOSITORY}" --clobber |