Skip to content

Commit

Permalink
chore(actions): update deployment action (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavFitz committed Dec 7, 2023
1 parent effa129 commit 1e9ace2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 21 deletions.
44 changes: 27 additions & 17 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,53 @@
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 }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
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.name }}" >> $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 }}
- name: Install polyglot
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/[email protected]
- 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 }}
18 changes: 14 additions & 4 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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|
Expand Down

0 comments on commit 1e9ace2

Please sign in to comment.