diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 58c670148..1e34f54d2 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -1,13 +1,23 @@ name: Deployment on: push: - tags: - - patch - - minor - - major + tags: + - patch + - minor + - major + workflow_dispatch: + inputs: + release: + type: choice + description: Deploy new package release + options: + - patch + - minor + - major + jobs: deploy: - runs-on: macos-12 + runs-on: macos-latest env: GITHUB_ACTION: ${{ github.action_path }} GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} @@ -15,12 +25,16 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.17' + go-version: "1.17" - name: Set release type environment run: | echo "RELEASE_TYPE=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + if [[ "$RELEASE_TYPE" != "patch" && "$RELEASE_TYPE" != "minor" && "$RELEASE_TYPE" != "major" ]]; then + echo "RELEASE_TYPE=${{ github.event.inputs.release }}" >> $GITHUB_ENV + fi - name: Check out polyglot - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@v4 with: repository: algolia/polyglot token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} @@ -28,16 +42,12 @@ jobs: run: | make install export PATH="$GOPATH/bin:$PATH" - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.2' - bundler-cache: true - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: maierj/fastlane-action@v3.0.0 + - uses: ruby/setup-ruby@v1 with: - lane: 'deploy' - verbose: 'true' - options: '{ "type": "${{ env.RELEASE_TYPE }}" }' - + ruby-version: "2.7.2" + bundler-cache: true + - name: Deploy library release + run: bundle exec fastlane deploy verbose:true type:${{ env.RELEASE_TYPE }} no_dry_run:true diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 11d66bbb2..ad45e78c6 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -48,6 +48,7 @@ lane :deploy do |options| repository_name = "algolia/algoliasearch-client-swift" podspec_path = "AlgoliaSearchClient.podspec" base_branch = options[:branch] || "master" + no_dry_run = options[:no_dry_run] || false # ensure branch and cleaniness locally but not on CI. if !ENV['GITHUB_ACTION'] @@ -105,10 +106,19 @@ lane :deploy do |options| sh("git tag -d #{release_type}; git push --delete origin #{release_type}") end - pod_push( - path: podspec_path, - allow_warnings: true - ) + if no_dry_run + pod_push( + path: podspec_path, + allow_warnings: true + ) + else + pod_lib_lint( + podspec: podspec_path, + verbose: true, + allow_warnings: true + ) + end + end lane :deployBeta do |options|