|
| 1 | +name: "Check if release needed" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: New version to release |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + |
| 11 | +jobs: |
| 12 | + cd: |
| 13 | + name: Build and Publish |
| 14 | + runs-on: macos-12 |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Setup Ruby |
| 21 | + uses: ruby/setup-ruby@v1 |
| 22 | + with: |
| 23 | + ruby-version: 2.7 |
| 24 | + |
| 25 | + - name: Setup repository |
| 26 | + uses: ./.github/actions/setup |
| 27 | + |
| 28 | + - name: Conventional Changelog Action |
| 29 | + id: conventional_changelog |
| 30 | + uses: TriPSs/conventional-changelog-action@v3 |
| 31 | + with: |
| 32 | + github-token: ${{ github.token }} |
| 33 | + git-message: 'chore(CHANGELOG): update for {version}' |
| 34 | + git-user-name: ${{ github.actor }} |
| 35 | + |
| 36 | + release-count: 0 |
| 37 | + version-file: './package.json' |
| 38 | + version-path: version |
| 39 | + fallback-version: '1.0.0' |
| 40 | + config-file-path: '.github/config/config.js' |
| 41 | + pre-commit: '.github/config/pre_commit_hook.js' |
| 42 | + pre-changelog-generation: '.github/config/pre_changelog_hook.js' |
| 43 | + env: |
| 44 | + VERSION: ${{ inputs.version }} |
| 45 | + |
| 46 | + - name: Build package products and documentation |
| 47 | + if: steps.conventional_changelog.outputs.skipped == 'false' |
| 48 | + run: | |
| 49 | + npm run build |
| 50 | + npm run build-doc |
| 51 | + npm run serve-doc |
| 52 | + npm run archive |
| 53 | +
|
| 54 | + - name: Release GitHub Pages |
| 55 | + if: steps.conventional_changelog.outputs.skipped == 'false' |
| 56 | + continue-on-error: true |
| 57 | + |
| 58 | + with: |
| 59 | + branch: gh-pages |
| 60 | + folder: .docc-build |
| 61 | + target-folder: docs |
| 62 | + clean: false |
| 63 | + commit-message: 'chore(GitHub Pages): release site for tag ${{ steps.conventional_changelog.outputs.tag }}' |
| 64 | + |
| 65 | + - name: Create GitHub Release |
| 66 | + if: steps.conventional_changelog.outputs.skipped == 'false' |
| 67 | + continue-on-error: true |
| 68 | + uses: ncipollo/release-action@v1 |
| 69 | + with: |
| 70 | + token: ${{ github.token }} |
| 71 | + tag: ${{ steps.conventional_changelog.outputs.tag }} |
| 72 | + body: ${{ steps.conventional_changelog.outputs.changelog }} |
| 73 | + artifacts: '*.zip' |
| 74 | + |
| 75 | + - name: Publish to CocoaPods trunk |
| 76 | + if: steps.conventional_changelog.outputs.skipped == 'false' |
| 77 | + continue-on-error: true |
| 78 | + run: | |
| 79 | + set -eo pipefail |
| 80 | + pod trunk push --skip-import-validation --skip-tests --allow-warnings |
| 81 | + env: |
| 82 | + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} |
| 83 | + |
| 84 | + - name: Publish to Swift Package Registry |
| 85 | + if: steps.conventional_changelog.outputs.skipped == 'false' |
| 86 | + continue-on-error: true |
| 87 | + uses: twodayslate/[email protected] |
0 commit comments