Release ValidationPackage.Codecs #3
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 ValidationPackage.Codecs" | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-validationpackage-codecs | |
| cancel-in-progress: false | |
| jobs: | |
| verify-and-pack: | |
| name: "Verify and pack Codecs" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up portable package toolchain | |
| uses: ./.github/actions/setup-portable | |
| - name: Run solution tests | |
| run: ./build.sh TestSolution | |
| - name: Test packed Codecs packages | |
| run: ./build.sh TestPortableCodecs | |
| - name: Preserve release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: validationpackage-codecs-release | |
| path: | | |
| artifacts/packages/ValidationPackage.Codecs.*.nupkg | |
| artifacts/packages/nfdi4plants-validationpackage-codecs-*.tgz | |
| artifacts/packages/validationpackage_codecs-*.whl | |
| artifacts/portable/validationpackage-codecs/javascript/package.json | |
| if-no-files-found: error | |
| retention-days: 7 | |
| overwrite: true | |
| publish-nuget: | |
| name: "Publish Codecs to NuGet" | |
| needs: verify-and-pack | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.x.x | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: validationpackage-codecs-release | |
| path: artifacts | |
| - name: NuGet login | |
| uses: NuGet/login@v1 | |
| id: nuget-login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Publish Codecs to NuGet | |
| run: dotnet nuget push ./artifacts/packages/ValidationPackage.Codecs.*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| publish-npm: | |
| name: "Publish Codecs to npm" | |
| needs: verify-and-pack | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| - name: Install npm with trusted-publishing support | |
| run: npm install --global npm@11.5.1 | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: validationpackage-codecs-release | |
| path: artifacts | |
| - name: Publish Codecs to npm | |
| shell: bash | |
| run: | | |
| shopt -s nullglob | |
| packages=(artifacts/packages/nfdi4plants-validationpackage-codecs-*.tgz) | |
| if [[ ${#packages[@]} -ne 1 ]]; then | |
| echo "Expected exactly one Codecs npm package, found ${#packages[@]}." >&2 | |
| exit 1 | |
| fi | |
| manifest=artifacts/portable/validationpackage-codecs/javascript/package.json | |
| package_name="$(node -p "require('./$manifest').name")" | |
| package_version="$(node -p "require('./$manifest').version")" | |
| if npm view "${package_name}@${package_version}" version >/dev/null 2>&1; then | |
| echo "${package_name}@${package_version} is already published; skipping." | |
| else | |
| npm publish "${packages[0]}" --access public | |
| fi | |
| publish-pypi: | |
| name: "Publish Codecs to PyPI" | |
| needs: verify-and-pack | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: validationpackage-codecs-release | |
| path: artifacts | |
| - name: Stage Codecs wheel | |
| shell: bash | |
| run: | | |
| shopt -s nullglob | |
| packages=(artifacts/packages/validationpackage_codecs-*.whl) | |
| if [[ ${#packages[@]} -ne 1 ]]; then | |
| echo "Expected exactly one Codecs wheel, found ${#packages[@]}." >&2 | |
| exit 1 | |
| fi | |
| mkdir -p artifacts/pypi | |
| cp "${packages[0]}" artifacts/pypi/ | |
| - name: Publish Codecs to PyPI | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | |
| with: | |
| packages-dir: artifacts/pypi | |
| skip-existing: true |