diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae54f1b40..245427b0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,26 @@ on: push: branches: [ master ] pull_request: - branches: [ master ] + branches: [ '**' ] env: CI_XCODE_11: '/Applications/Xcode_11.7.app/Contents/Developer' CI_XCODE_13: '/Applications/Xcode_13.1.app/Contents/Developer' jobs: + release-dry-run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: npm ci + - run: npx semantic-release + - name: Determine tag for next release + run: echo $(git describe --tags --abbrev=0 --exact-match || echo '') + ios: runs-on: macos-latest steps: @@ -34,7 +48,6 @@ jobs: - name: Send codecov run: bash <(curl https://codecov.io/bash) - macos: runs-on: macos-latest steps: @@ -152,7 +165,7 @@ jobs: env: DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} - release: + upload-assets: runs-on: macos-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release-automated.yml similarity index 62% rename from .github/workflows/release.yml rename to .github/workflows/release-automated.yml index 23f1af38e..15e8e6b46 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-automated.yml @@ -1,16 +1,41 @@ -name: release +name: release-automated on: - release: - types: [published] + push: + branches: [ master, release, alpha, beta ] env: CI_XCODE_11: '/Applications/Xcode_11.7.app/Contents/Developer' CI_XCODE_13: '/Applications/Xcode_13.0.app/Contents/Developer' jobs: + release: + runs-on: ubuntu-latest + outputs: + current_tag: ${{ steps.tag.outputs.current_tag }} + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: npm ci + - run: npx semantic-release + env: + GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Determine tag on current commit + id: tag + run: echo "::set-output name=current_tag::$(git describe --tags --abbrev=0 --exact-match || echo '')" + cocoapods: + needs: release + if: needs.release.outputs.current_tag != '' runs-on: macos-11 steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ needs.release.outputs.current_tag }} - name: CocoaPods run: set -o pipefail && env NSUnbufferedIO=YES pod lib lint --allow-warnings --verbose - name: Deploy CocoaPods @@ -19,10 +44,15 @@ jobs: COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} - docs: + upload-assets: + needs: release + if: needs.release.outputs.current_tag != '' runs-on: macos-11 steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ needs.release.outputs.current_tag }} - name: Cache Gems id: cache-gems uses: actions/cache@v2 @@ -31,25 +61,34 @@ jobs: key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | ${{ runner.os }}-gem- - - name: Install Bundle + - name: Submodules and Bundle Install run: | - bundle config path vendor/bundle + git submodule update --init --recursive + sudo gem install bundler + bundle config set path 'vendor/bundle' bundle install - - name: Create Jazzy Docs - run: | - ./Scripts/jazzy.sh + - name: Build Release + run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake package:release env: - DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} - - name: Deploy Jazzy Docs - uses: peaceiris/actions-gh-pages@v3 + DEVELOPER_DIR: ${{ env.CI_XCODE_11 }} + - name: Deploy assets + uses: svenstaro/upload-release-action@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/release/* + tag: ${{ needs.release.outputs.current_tag }} + overwrite: true + file_glob: true - release: + publish-docs: + needs: release + if: needs.release.outputs.current_tag != '' runs-on: macos-11 steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ needs.release.outputs.current_tag }} - name: Cache Gems id: cache-gems uses: actions/cache@v2 @@ -58,21 +97,17 @@ jobs: key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | ${{ runner.os }}-gem- - - name: Submodules and Bundle Install + - name: Install Bundle run: | - git submodule update --init --recursive - sudo gem install bundler - bundle config set path 'vendor/bundle' + bundle config path vendor/bundle bundle install - - name: Build Release - run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake package:release + - name: Create Jazzy Docs + run: | + ./Scripts/jazzy.sh env: - DEVELOPER_DIR: ${{ env.CI_XCODE_11 }} - - name: Deploy assets - uses: svenstaro/upload-release-action@v2 + DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} + - name: Deploy Jazzy Docs + uses: peaceiris/actions-gh-pages@v3 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/release/* - tag: ${{ github.ref }} - overwrite: true - file_glob: true + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs