name: Release on: workflow_dispatch: inputs: releaseVersion: description: The release version for which to build and upload artifacts required: true type: string release: types: [ published ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Extract release version when job started by release being published run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV if: ${{ github.event_name == 'release' }} - name: Extract release version when job manually started run: echo "RELEASE_VERSION=${{ inputs.releaseVersion }}" >> $GITHUB_ENV if: ${{ github.event_name == 'workflow_dispatch' }} - name: Build the plugins run: | swift build --configuration=release --product protoc-gen-swift cp ./.build/release/protoc-gen-swift . swift build --configuration=release --product protoc-gen-grpc-swift cp ./.build/release/protoc-gen-grpc-swift . - name: Zip the plugins run: | zip protoc-grpc-swift-plugins-linux-x86_64-${{ env.RELEASE_VERSION }}.zip protoc-gen-swift protoc-gen-grpc-swift - name: Upload artifacts uses: softprops/action-gh-release@v1 with: files: protoc-grpc-swift-plugins-linux-x86_64-${{ env.RELEASE_VERSION }}.zip