| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- name: Publish
- on:
- workflow_dispatch:
- inputs:
- crate:
- description: Crate
- required: true
- default: sdk/pinocchio
- type: choice
- options:
- - programs/associated-token-account
- - programs/system
- - programs/token
- - sdk/log/crate
- - sdk/log/macro
- - sdk/pinocchio
- - sdk/pubkey
- level:
- description: Level
- required: true
- default: patch
- type: choice
- options:
- - patch
- - minor
- - major
- dry_run:
- description: Dry run
- required: true
- default: true
- type: boolean
- create_release:
- description: Create a GitHub release
- required: true
- type: boolean
- default: true
- env:
- CACHE: true
- jobs:
- publish_release:
- name: Publish
- runs-on: ubuntu-latest
- steps:
- - name: Ensure CARGO_REGISTRY_TOKEN variable is set
- env:
- token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- if: ${{ env.token == '' }}
- run: |
- echo "The CARGO_REGISTRY_TOKEN secret variable is not set"
- echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"."
- exit 1
- - name: Git checkout
- uses: actions/checkout@v4
- - name: Setup Environment
- uses: ./.github/actions/setup
- with:
- cargo-cache-key: cargo-publish
- toolchain: test
- components: semver-checks
- solana: true
- - name: Build
- run: pnpm build-sbf ${{ inputs.crate }}
- - name: Test
- run: pnpm test ${{ inputs.crate }}
- - name: Set Git Author
- run: |
- git config --global user.email "github-actions@github.com"
- git config --global user.name "github-actions"
- - name: Check semver
- run: |
- pnpm semver ${{ inputs.crate }} --release-type ${{ inputs.level }}
- - name: Publish Crate
- id: publish
- env:
- CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- run: |
- if [ "${{ inputs.dry_run }}" == "true" ]; then
- OPTIONS="--dry-run"
- else
- OPTIONS=""
- fi
- pnpm tsx ./scripts/publish.mts ${{ inputs.crate }} ${{ inputs.level }} $OPTIONS
- - name: Create GitHub release
- if: github.event.inputs.dry_run != 'true' && github.event.inputs.create_release == 'true'
- uses: ncipollo/release-action@v1
- with:
- tag: ${{ steps.publish.outputs.crate }}@v${{ steps.publish.outputs.version }}
|