Skip to content

Commit ea85f6e

Browse files
committed
chore(actions): update deployment action (#844)
1 parent effa129 commit ea85f6e

File tree

2 files changed

+41
-21
lines changed

2 files changed

+41
-21
lines changed

.github/workflows/deployment.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,53 @@
11
name: Deployment
22
on:
33
push:
4-
tags:
5-
- patch
6-
- minor
7-
- major
4+
tags:
5+
- patch
6+
- minor
7+
- major
8+
workflow_dispatch:
9+
inputs:
10+
release:
11+
type: choice
12+
description: Deploy new package release
13+
options:
14+
- patch
15+
- minor
16+
- major
17+
818
jobs:
919
deploy:
10-
runs-on: macos-12
20+
runs-on: macos-latest
1121
env:
1222
GITHUB_ACTION: ${{ github.action_path }}
1323
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
1424
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
1525
steps:
1626
- uses: actions/setup-go@v5
1727
with:
18-
go-version: '1.17'
28+
go-version: "1.17"
1929
- name: Set release type environment
2030
run: |
2131
echo "RELEASE_TYPE=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
32+
33+
if [[ "$RELEASE_TYPE" != "patch" && "$RELEASE_TYPE" != "minor" && "$RELEASE_TYPE" != "major" ]]; then
34+
echo "RELEASE_TYPE=${{ github.event.inputs.release }}" >> $GITHUB_ENV
35+
fi
2236
- name: Check out polyglot
23-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
37+
uses: actions/checkout@v4
2438
with:
2539
repository: algolia/polyglot
2640
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
2741
- name: Install polyglot
2842
run: |
2943
make install
3044
export PATH="$GOPATH/bin:$PATH"
31-
- uses: ruby/setup-ruby@v1
32-
with:
33-
ruby-version: '2.7.2'
34-
bundler-cache: true
35-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
45+
- uses: actions/checkout@v4
3646
with:
3747
fetch-depth: 0
38-
- uses: maierj/[email protected]
48+
- uses: ruby/setup-ruby@v1
3949
with:
40-
lane: 'deploy'
41-
verbose: 'true'
42-
options: '{ "type": "${{ env.RELEASE_TYPE }}" }'
43-
50+
ruby-version: "2.7.2"
51+
bundler-cache: true
52+
- name: Deploy library release
53+
run: bundle exec fastlane deploy verbose:true type:${{ env.RELEASE_TYPE }} no_dry_run:true

fastlane/Fastfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ lane :deploy do |options|
4848
repository_name = "algolia/algoliasearch-client-swift"
4949
podspec_path = "AlgoliaSearchClient.podspec"
5050
base_branch = options[:branch] || "master"
51+
no_dry_run = options[:no_dry_run] || false
5152

5253
# ensure branch and cleaniness locally but not on CI.
5354
if !ENV['GITHUB_ACTION']
@@ -105,10 +106,19 @@ lane :deploy do |options|
105106
sh("git tag -d #{release_type}; git push --delete origin #{release_type}")
106107
end
107108

108-
pod_push(
109-
path: podspec_path,
110-
allow_warnings: true
111-
)
109+
if no_dry_run
110+
pod_push(
111+
path: podspec_path,
112+
allow_warnings: true
113+
)
114+
else
115+
pod_lib_lint(
116+
podspec: podspec_path,
117+
verbose: true,
118+
allow_warnings: true
119+
)
120+
end
121+
112122
end
113123

114124
lane :deployBeta do |options|

0 commit comments

Comments
 (0)