https://github.com/lando/prepare-release-action
Prepare a Lando plugin for publishing to a package registry.
https://github.com/lando/prepare-release-action
devops github-actions
Last synced: 6 months ago
JSON representation
Prepare a Lando plugin for publishing to a package registry.
- Host: GitHub
- URL: https://github.com/lando/prepare-release-action
- Owner: lando
- License: mit
- Created: 2023-06-07T19:43:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-19T02:42:24.000Z (6 months ago)
- Last Synced: 2025-07-19T07:40:48.783Z (6 months ago)
- Topics: devops, github-actions
- Language: JavaScript
- Homepage:
- Size: 1.43 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Prepare Release Action
This action allows you to automate release steps eg bump version, compile code, bundle deps and optionally push/sync those changes back to a source repo that you've fetched with [`@actions/checkout`](https://github.com/actions/checkout). It _may_ work with repos fetched in a different way but that use case is not tested or supported so YMMV.
It was orignally designed to help automate Lando Plugin deployment and has an easy-mode `lando-plugin` input, however, you should be able to use it on any javascripty project.
## Inputs
All inputs are optional however if you are **NOT** triggering this action on a `release` then you will need to set `version`.
| Name | Description | Default | Example |
|---|---|---|---|
| `version` | The version of the thing to be released. Must be a semver valid string. | `${{ github.event.release.tag_name }}` | `v3.14.0` |
| `bundle-dependencies` | A toggle to autoset `bundleDependencies` in `package.json`. | `false` | `true` |
| `commands` | A list of commands to run to prepare the release. | `[]` | `npm run prepare` |
| `meta` | A list of `path=value` strings to merge into the `package.json` | `null` | `dist=thing` |
| `root` | The location of the code being prepared for release. | `${{ github.workspace }}` | `/path/to/my/project` |
| `sync` | A toggle to enable/disable code syncing. | `true` | `false` |
| `sync-branch` | The target branch to use when syncing changes back to the repo. | `${{ github.event.release.target_commitish \|\| github.event.pull_request.head.ref \|\| github.ref_name }}` | `main` |
| `sync-email` | The email to use when syncing changes back to the repo. | `github-actions@github.com` | `riker@starfleet.gov` |
| `sync-message` | The commit message to use when syncing changes back to the repo. | `release v%s generated by @lando/prepare-release-action` | `RELEASE %s` |
| `sync-tags` | A list of other tags to sync back to the repo. | `[]` | `v2` |
| `sync-token` | A Personal Access Token to use for `git` sync ops. | `${{ github.token }}` | `${{ secrets.MY_PAT }}` |
| `sync-username` | The username to use when syncing changes back to the repo. | `github-actions` | `w.t.riker` |
| `update-files` | The files to operate on with update-files-meta and update-files-header. | `[]` | `CHANGELOG.md` |
| `update-files-header` | A header to prepend to update-files after they've been operated on. | `[]` | `{{ ## NEW VERSION }}` |
| `update-files-meta` | The find/replace metadata to be used when updating update-files. | `[]` | `NEW_VERSION=${{ github.event.release.tag_name }}` |
| `version-match` | A regex to help find the latest tag. Only used when `version=dev`. | `v[0-9].*` | `[1-2].*` |
| `lando-plugin` | A special easy-mode setting to prepare and valdiate Lando plugins. | `false` | `true` |
Note that `sync` must be set to `true` for the other `sync-*` options to do anything. Also note that in `sync-message` you can use `%s` as a placeholder for the version.
Also note that `sync-username` and `sync-email` are simply for `git config` purposes and *DO NOT* map to a GitHub user. If you want to do remote git ops as a particular user then use `sync-token`.
Also also note that `bundle-dependencies` runs _after_ sync eg it will not push changes to `bundleDependencies` in your `package.json` back to your repo. It is intended to be used for packaging dependencies when publishing to a npm compatible package registry eg `npm` or `npm.pkg.github.com`.
Also note that while `update-files-meta` is expressed as `KEY=VALUE` it must be wrapped with double brackets like `{{ KEY }}` in the relevant `update-files` for it to be properly tokenized/replaced. See our [CHANGELOG.md](https://github.com/lando/prepare-release-action/blob/main/CHANGELOG.md) for an example using the below inputs:
```yaml
update-files: CHANGELOG.md
update-files-header: |
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
update-files-meta: |
UNRELEASED_DATE=May 4, 3000
UNRELEASED_LINK=${{ github.repositoryUrl }}
UNRELEASED_VERSION=v${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt}}-build.${{ github.sha }}
```
## Caveats
* If your project is a shallow clone (as is the default for `@actions/checkout`) we will `--unshallow` it to a full clone in order to sync changes.
* If you have [branch](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule) or [tag protection](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules) turned on you will need to make sure your rules allow the `sync-token` user to both write to the `sync-branch` and `sync-tags` and to allow a `--force` alteration of the repos tags.
## Usage
### Basic Usage
```yaml
- name: Prepare Release
uses: lando/prepare-release-action@v3
```
### Advanced Usage
**Lando Plugin example:**
```yaml
- name: Prepare Release
uses: lando/prepare-release-action@v3
with:
lando-plugin: true
```
**GitHub Action javascript action example:**
```yaml
- name: Prepare Release
uses: lando/prepare-release-action@v3
with:
commands: |
npm run prepare
sync-tags: v3
```
**Everything, everywhere, all at once:**
```yaml
- name: Prepare Release
uses: lando/prepare-release-action@v3
with:
version: v3.1.4-riker.1
bundle-dependencies: true
commands: |
touch riker
npm run prepare
meta: |
jazzman=William T. Riker
bosmang=Picard
lando-plugin: false
sync: true
sync-branch: kirk-epsilon
sync-email: riker@hotmale.com
sync-message: "Execute evasive manuveur pattern Riker %s"
sync-tags: |
v1
riker1
number2
sync-token: ${{ secrets.MY_PAT }}
sync-username: w.t.riker
update-files: CHANGELOG.md
update-files-header: |
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
update-files-meta: |
UNRELEASED_DATE=May 4, 3000
UNRELEASED_LINK=${{ github.repositoryUrl }}
UNRELEASED_VERSION=v${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt}}-build.${{ github.sha }}
version-match: "v[0-2].*"
```
## Changelog
We try to log all changes big and small in both [THE CHANGELOG](https://github.com/lando/prepare-release-action/blob/main/CHANGELOG.md) and the [release notes](https://github.com/lando/prepare-release-action/releases).
## Releasing
Create a release and publish to [GitHub Actions Marketplace](https://docs.github.com/en/enterprise-cloud@latest/actions/creating-actions/publishing-actions-in-github-marketplace)
## Maintainers
* [@pirog](https://github.com/pirog)
* [@reynoldsalec](https://github.com/reynoldsalec)
## Contributors
Made with [contrib.rocks](https://contrib.rocks).
## Other Resources
* [LICENSE](/LICENSE)
* [TERMS OF USE](https://docs.lando.dev/terms)
* [PRIVACY POLICY](https://docs.lando.dev/privacy)