|
| 1 | +name: Upload Release Archive |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "[0-9]+\\.[0-9]+\\.[0-9]+" |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Upload Release Asset |
| 11 | + runs-on: macos-latest |
| 12 | + steps: |
| 13 | + - name: Set version |
| 14 | + id: version |
| 15 | + run: | |
| 16 | + REPOSITORY=$(echo ${{ github.repository }} | sed -e "s#.*/##") |
| 17 | + VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g") |
| 18 | + echo ::set-output name=version::$VERSION |
| 19 | + echo ::set-output name=filename::$REPOSITORY-$VERSION |
| 20 | + echo "Version $VERSION" |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v2 |
| 23 | + with: |
| 24 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + submodules: true |
| 26 | + |
| 27 | + - name: Generate Xcode project and install Pods |
| 28 | + env: |
| 29 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + run: | |
| 31 | + swift package generate-xcodeproj |
| 32 | + - name: Archive |
| 33 | + run: | |
| 34 | + zip -r ${{ steps.version.outputs.filename }}.zip ./ -x "*.git*" |
| 35 | + - name: Create Release |
| 36 | + id: create_release |
| 37 | + uses: actions/create-release@v1 |
| 38 | + env: |
| 39 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + with: |
| 41 | + tag_name: ${{ github.ref }} |
| 42 | + release_name: Release ${{ github.ref }} |
| 43 | + draft: false |
| 44 | + prerelease: false |
| 45 | + - name: Upload Release Asset |
| 46 | + id: upload-release-asset |
| 47 | + uses: actions/upload-release-asset@v1 |
| 48 | + env: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + with: |
| 51 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 52 | + asset_path: ./${{ steps.version.outputs.filename }}.zip |
| 53 | + asset_name: ${{ steps.version.outputs.filename }}.zip |
| 54 | + asset_content_type: application/zip |
0 commit comments