release.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. name: Release
  2. permissions:
  3. contents: read
  4. on:
  5. workflow_dispatch:
  6. inputs:
  7. releaseVersion:
  8. description: The release version for which to build and upload artifacts
  9. required: true
  10. type: string
  11. release:
  12. types: [ published ]
  13. jobs:
  14. build:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v3
  18. - name: Extract release version when job started by release being published
  19. run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
  20. if: ${{ github.event_name == 'release' }}
  21. - name: Extract release version when job manually started
  22. run: echo "RELEASE_VERSION=${{ inputs.releaseVersion }}" >> $GITHUB_ENV
  23. if: ${{ github.event_name == 'workflow_dispatch' }}
  24. - name: Build the plugins
  25. run: |
  26. swift build --configuration=release --product protoc-gen-swift
  27. cp ./.build/release/protoc-gen-swift .
  28. swift build --configuration=release --product protoc-gen-grpc-swift
  29. cp ./.build/release/protoc-gen-grpc-swift .
  30. - name: Zip the plugins
  31. run: |
  32. zip protoc-grpc-swift-plugins-linux-x86_64-${{ env.RELEASE_VERSION }}.zip protoc-gen-swift protoc-gen-grpc-swift
  33. - name: Upload artifacts
  34. uses: softprops/action-gh-release@v1
  35. with:
  36. files: protoc-grpc-swift-plugins-linux-x86_64-${{ env.RELEASE_VERSION }}.zip