Skip to content

Commit

Permalink
try to generate pod
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed Jan 13, 2020
1 parent f2b3152 commit f94999f
Showing 1 changed file with 105 additions and 16 deletions.
121 changes: 105 additions & 16 deletions .github/workflows/lona-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ jobs:

- name: Pass variables to other actions (1/2)
run: |
mkdir -p .artifact-path
echo -e "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}\n::set-output name=new_version::${{ steps.tag_version.outputs.new_version }}\n" > .artifact-path/variables.txt
mkdir -p .__lona-artifact-path
echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}
::set-output name=new_version::${{ steps.tag_version.outputs.new_version }}
::set-output name=new_tag::${{ steps.tag_version.outputs.new_tag }}
" > .__lona-artifact-path/variables.txt
- name: Pass variables to other actions (2/2)
uses: actions/upload-artifact@v1
with:
name: lona-variables
path: .artifact-path
path: .__lona-artifact-path

sketch-library:
runs-on: macos-latest
Expand All @@ -83,12 +86,12 @@ jobs:
uses: actions/download-artifact@v1
with:
name: lona-variables
path: .artifact-path
path: .__lona-artifact-path
- name: Get variables from documentation (2/2)
run: |
while read p; do
echo "$p"
done <.artifact-path/variables.txt
done <.__lona-artifact-path/variables.txt
id: variables

- name: Get the latest version of the repository
Expand All @@ -103,16 +106,15 @@ jobs:
run: npm install lonac @lona/workspace-to-sketch-library

- name: Generate the Sketch library
run: 'node -e "require(''@lona/workspace-to-sketch-library'').default(process.cwd(), ''.artifact-path/sketch-library.sketch'', { logFunction: console.log.bind(console) }).catch(err => { console.log(err); process.exit(1); })"'
run: 'node -e "require(''@lona/workspace-to-sketch-library'').default(process.cwd(), ''.__lona-artifact-path/sketch-library.sketch'', { logFunction: console.log.bind(console) }).catch(err => { console.log(err); process.exit(1); })"'

- name: Publish the Sketch Library to the release
id: upload_sketch_library
- name: Publish the Sketch Library to the GitHub release
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.variables.outputs.upload_url }}
asset_path: .artifact-path/sketch-library.sketch
asset_path: .__lona-artifact-path/sketch-library.sketch
asset_name: library.sketch
asset_content_type: application/zip

Expand All @@ -124,12 +126,12 @@ jobs:
uses: actions/download-artifact@v1
with:
name: lona-variables
path: .artifact-path
path: .__lona-artifact-path
- name: Get variables from documentation (2/2)
run: |
while read p; do
echo "$p"
done <.artifact-path/variables.txt
done <.__lona-artifact-path/variables.txt
id: variables

- name: Get the latest version of the repository
Expand All @@ -143,13 +145,100 @@ jobs:
- name: Install the Lona Compiler
run: npm install lonac

- name: Generate and publish npm package
- name: Generate js sources
run: ./node_modules/.bin/lonac workspace --workspace . --target js --output ./__lona-npm-output

- name: Generate package.json
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
./node_modules/.bin/lonac workspace --workspace . --target js --output ./__secret_npm_output
cd __secret_npm_output
REPO_LOWERCASE=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "{ \"name\": \"@$REPO_LOWERCASE\", \"version\": \"${{ steps.variables.outputs.new_version }}\", \"publishConfig\": { \"registry\": \"https://npm.pkg.github.com/\" }, \"repository\": \"git://github.com/${{ github.repository }}\" }" >> package.json
echo "{
\"name\": \"@$REPO_LOWERCASE\",
\"version\": \"${{ steps.variables.outputs.new_version }}\",
\"publishConfig\": { \"registry\": \"https://npm.pkg.github.com/\" },
\"repository\": \"git://github.com/${{ github.repository }}\"
}" >> package.json
working-directory: ./__lona-npm-output

- name: Publish package to GitHub Package Registry
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
npm publish
working-directory: ./__lona-npm-output
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cocoapod:
runs-on: macos-latest
needs: [documentation]
steps:
- name: Get variables from documentation (1/2)
uses: actions/download-artifact@v1
with:
name: lona-variables
path: .__lona-artifact-path
- name: Get variables from documentation (2/2)
run: |
while read p; do
echo "$p"
done <.__lona-artifact-path/variables.txt
id: variables

- name: Get the latest version of the repository
uses: actions/checkout@v1

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "12.x"

- name: Install the Lona Compiler
run: npm install lonac

- name: Install cocoapods-generate
run: gem install cocoapods-generate

- name: Generate Swift sources
run: ./node_modules/.bin/lonac workspace --workspace=. --target=swift --output=./.lona-pod/Sources

- name: Create podspec
run: |
REPO_NAME=$(echo "${{ github.repository }}" | tr '/' '_')
echo "Pod::Spec.new do |s|
s.name = \"$REPO_NAME\"
s.version = \"${{ steps.variables.outputs.new_version }}\"
s.summary = \"\"
s.homepage = \"https://github.com/${{ github.repository }}\"
s.license = \"None\"
s.source = { :http => 'https://github.com/${{ github.repository }}/releases/download/${{ steps.variables.outputs.new_tag }}/pod.zip' }
s.source_files = "Sources/**/*.{m,h,swift}"
s.ios.deployment_target = '10'
s.macos.deployment_target = '10.12'
end" >> pod.podspec
working-directory: ./.lona-pod

- name: Generate Workspace
run: pod gen ./pod.podspec --gen-directory=.
working-directory: ./.lona-pod

- name: Archive pod
run: zip -r ./.lona-pod-archive.zip ./lona-pod

- name: Publish the podspec to the GitHub release
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.variables.outputs.upload_url }}
asset_path: ./.lona-pod/pod.podspec
asset_name: pod.podspec
asset_content_type: text/plain

- name: Publish the Pod to the GitHub release
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.variables.outputs.upload_url }}
asset_path: ./.lona-pod-archive.zip
asset_name: pod.zip
asset_content_type: application/zip

0 comments on commit f94999f

Please sign in to comment.