devolutions-crypto 0.9.2

An abstraction layer for the cryptography used by Devolutions
Documentation
name: Deploy to production (Others)
on:
  workflow_dispatch:
    inputs:
      publish_crate_rust:
        description: "Publish Rust Crate"
        required: true
        type: boolean
      publish_kotlin:
        description: "Publish Kotlin"
        required: true
        type: boolean
      publish_npm:
        description: "Publish NPM"
        required: true
        type: boolean
      publish_python:
        description: "Publish Python"
        required: true
        type: boolean
      publish_dry_run:
        description: "Dry Run Mode"
        required: true
        type: boolean
jobs:
  deploy:
    runs-on: ubuntu-22.04
    environment: publish
    steps:
    - uses: actions/checkout@v4

    - name: Check out for Rust release
      uses: actions/checkout@v4
      with:
        path: ./rust-release/

    - name: Check out devolutions/actions
      uses: actions/checkout@v4
      with:
        path: ./.github/workflows
        ref: v1
        repository: Devolutions/actions
        token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}

    - name: Install toolbox
      uses: ./.github/workflows/toolbox-install
      with:
        github_token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}

    - name: Download Artifact
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        CI: true
      run: |
        dv github download-artifact python-wheels-linux . devolutions-crypto
        dv github download-artifact python-wheels-macos . devolutions-crypto
        dv github download-artifact python-wheels-windows . devolutions-crypto
        dv github download-artifact kotlin . devolutions-crypto

    - name: Download NPM Artifact
      run: dv github download-artifact wasm . devolutions-crypto
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        CI: true

    - name: Extract Artifacts
      run: |
        7z x python-wheels-linux.zip -o./devolutions-crypto-wheels
        7z x python-wheels-macos.zip -o./devolutions-crypto-wheels
        7z x python-wheels-windows.zip -o./devolutions-crypto-wheels

        7z x wasm.zip -o./devolutions-crypto-npm
        7z x kotlin.zip -o./devolutions-crypto-maven

    - name: Publish Rust Crate
      if: ${{ inputs.publish_crate_rust }}
      working-directory: ./rust-release
      run: |
        if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
          cargo publish --dry-run
        else
          cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
        fi

    - name: Publish NPM Bundler
      if: ${{ inputs.publish_npm }}
      working-directory: ./devolutions-crypto-npm/bundler
      run: |
        npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}

        if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
          npm publish --access=public --dry-run
        else
          npm publish --access=public
        fi

    - name: Publish NPM Web
      if: ${{ inputs.publish_npm }}
      working-directory: ./devolutions-crypto-npm/web
      run: |
        npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}

        if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
          npm publish --access=public --dry-run
        else
          npm publish --access=public
        fi

    - name: Update Artifactory Cache
      if: ${{ inputs.publish_npm && !inputs.publish_dry_run }}
      run: gh workflow run update-artifactory-cache.yml --repo Devolutions/scheduled-tasks --field package_name="devolutions-crypto"
      env:
        GH_TOKEN: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}

    - name: Publish Python
      if: ${{ inputs.publish_python }}
      run: |
        pip install twine

        if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
          twine upload --verbose  --repository testpypi -u "__token__" -p ${{ secrets.TESTPYPI_OWNER_API_KEY  }} ./devolutions-crypto-wheels/*
        else
          twine upload --verbose -u "__token__" -p ${{ secrets.PYPI_OWNER_API_KEY }} ./devolutions-crypto-wheels/*
        fi

    - name: Publish Kotlin to Cloudsmith
      if: ${{ inputs.publish_kotlin }}
      run: |
        pip install --upgrade cloudsmith-cli

        cloudsmith push maven devolutions/maven-public devolutions-crypto-maven/libs/lib.jar \
          --pom-file=devolutions-crypto-maven/publications/maven/pom-default.xml \
      env:
        CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}