Skip to content

Commit

Permalink
Merge pull request #11 from modestman/feature/github-actions
Browse files Browse the repository at this point in the history
Add github actions for run tests and release
  • Loading branch information
subdan authored May 29, 2020
2 parents 33244eb + 83db8ec commit 4755c7e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
release:
types:
- published

jobs:
release:
name: Publish GitHub and Cocoapods release
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build
run: |
swift build -c release
cp ./.build/x86_64-apple-macosx/release/figma-export ./Release/figma-export
zip -r figma-export.zip Release LICENSE
- name: "Get upload_url"
run: echo "::set-output name=upload_url::https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)/assets{?name,label}"
id: release

- name: Upload GitHub Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./figma-export.zip
asset_name: figma-export.zip
asset_content_type: application/zip

- name: Install Cocoapods
run: gem install cocoapods

- name: Deploy to Cocoapods
run: |
set -eo pipefail
pod trunk push FigmaExport.podspec
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test
on:
# Trigger the workflow on push or pull request,
# for all branches, but never trigger on new tags
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
branches:
- '**'

jobs:
test:
name: Run tests
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Copy config
run: cp Release/figma-export.yaml ./
- name: Build and test
run: swift test --enable-code-coverage --disable-automatic-resolution
4 changes: 2 additions & 2 deletions FigmaExport.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Pod::Spec.new do |spec|
spec.homepage = "https://github.com/RedMadRobot/figma-export"
spec.license = { type: "MIT", file: "LICENSE" }
spec.author = { "Daniil Subbotin" => "[email protected]" }
spec.source = { git: 'https://github.com/RedMadRobot/figma-export.git', tag: spec.version.to_s }
spec.preserve_paths = 'Release/figma-export'
spec.source = { http: "#{spec.homepage}/releases/download/#{spec.version}/figma-export.zip" }
spec.preserve_paths = '*'
end
Binary file removed Release/figma-export
Binary file not shown.

0 comments on commit 4755c7e

Please sign in to comment.