Skip to content

Commit

Permalink
feat(release): use open-turo/actions-release
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoro9 committed Feb 1, 2024
1 parent cdcea13 commit 5df27f1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
5 changes: 3 additions & 2 deletions release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ If you are using this action for protected branches, replace `GITHUB_TOKEN` with
| parameter | description | required | default |
| --- | --- | --- | --- |
| checkout-repo | Perform checkout as first step of action | `false` | true |
| github-token | GitHub token that can checkout the repository as well as create tags/releases against it. e.g. 'secrets.GITHUB_TOKEN' | `true` | |
| dry-run | Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file | `false` | false |
| checkout-fetch-depth | The number of commits to fetch. 0 indicates all history for all branches and tags | `false` | 0 |
| github-token | GitHub token that can checkout the consumer repository as well as create tags/releases against it. e.g. 'secrets.GITHUB_TOKEN' | `true` | |
| dry-run | Whether to run semantic release in `dry-run` mode. It will override the `dryRun` attribute in your configuration file | `false` | false |
| extra-plugins | Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer. Defaults to install @open-turo/semantic-release-config. | `false` | @open-turo/semantic-release-config |
<!-- action-docs-inputs -->

Expand Down
41 changes: 30 additions & 11 deletions release/action.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: GitHub Action Release and Publish
name: Action Release & Publish
description: GitHub Action to publish a new release
inputs:
checkout-repo:
required: false
description: Perform checkout as first step of action
default: "true"
checkout-fetch-depth:
required: false
description: The number of commits to fetch. 0 indicates all history for all branches and tags
default: "0"
github-token:
required: true
description: GitHub token that can checkout the repository as well as create tags/releases against it. e.g. 'secrets.GITHUB_TOKEN'
description: GitHub token that can checkout the consumer repository as well as create tags/releases against it. e.g. 'secrets.GITHUB_TOKEN'
dry-run:
required: false
description: Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file
description: Whether to run semantic release in `dry-run` mode. It will override the `dryRun` attribute in your configuration file
default: "false"
extra-plugins:
required: false
Expand All @@ -20,29 +24,44 @@ inputs:
outputs:
new-release-published:
description: Whether a new release was published
value: ${{ steps.release.outputs.new_release_published }}
value: ${{ steps.release.outputs.new-release-published }}
new-release-version:
description: Version of the new release
value: ${{ steps.release.outputs.new_release_version }}
value: ${{ steps.release.outputs.new-release-version }}
new-release-major-version:
description: Major version of the new release
value: ${{ steps.release.outputs.new_release_major_version }}
value: ${{ steps.release.outputs.new-release-major-version }}
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4
if: inputs.checkout-repo == 'true'
with:
fetch-depth: 0
fetch-depth: ${{ inputs.checkout-fetch-depth }}
persist-credentials: false
- name: Setup tools
uses: open-turo/action-setup-tools@v1
uses: open-turo/action-setup-tools@v2
- uses: 8BitJonny/[email protected]
id: PR
with:
sha: ${{ github.event.pull_request.head.sha }}
- name: Branches configuration
id: branches-configuration
shell: bash
run: |
if [ -z "${{ steps.PR.outputs.number }}" ]; then
echo "branches=${{ github.event.repository.default_branch }}" >> $GITHUB_OUTPUT
else
echo "branches=[\"${{ github.event.repository.default_branch }}\", {\"name\": \"${{ github.ref_name }}\",\"channel\": \"next\",\"prerelease\": \"pr-${{ steps.PR.outputs.number }}.${{ github.run_number }}.${{ github.run_attempt }}\"}]" >> $GITHUB_OUTPUT
fi
- name: Release
id: release
uses: cycjimmy/semantic-release-action@v3
uses: open-turo/actions-release/semantic-release@v4
with:
dry_run: ${{ inputs.dry-run }}
extra_plugins: ${{ inputs.extra-plugins }}
branches: ${{ steps.branches-configuration.outputs.branches }}
dry-run: ${{ inputs.dry-run }}
extra-plugins: ${{ inputs.extra-plugins }}
github-token: ${{ inputs.github-token }}
env:
GITHUB_TOKEN: ${{ inputs.github-token }}

0 comments on commit 5df27f1

Please sign in to comment.