1 Commits

Author SHA1 Message Date
715528c92e feat(workflow): experimental reusable workflow 2023-05-10 00:50:15 +01:00
8 changed files with 256 additions and 107 deletions

View File

@@ -1,3 +1,3 @@
{
".": "1.0.2"
".": "1.0.1"
}

View File

@@ -1,33 +0,0 @@
---
name: Release
on: push
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: make docs
- name: Verify no changes after docs build
run: |
git diff --exit-code
release-please:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: jimeh/release-please-manifest-action@v1
id: release
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
- name: MAJOR and MAJOR.MINOR tags
if: ${{ steps.release.outputs.release_created }}
uses: jimeh/update-tags-action@v1
with:
tags: |
v${{ steps.release.outputs.major }}
v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}

187
.github/workflows/manifest.yml vendored Normal file
View File

@@ -0,0 +1,187 @@
---
name: release-please-manifest
on:
workflow_call:
#
# Secrets
#
secrets:
token:
description: GitHub token used to authenticate.
required: false
app-id:
description: >-
ID of the GitHub App to use for authentication. If set, takes
precedence over token input.
required: false
private-key:
description: >-
Private key of the GitHub App (can be Base64 encoded). Required when
app-id is provided.
required: false
#
# Inputs
#
inputs:
runs_on:
description: "GitHub Actions runs-on value for release please job."
default: "ubuntu-latest"
type: string
required: false
installation-id:
description: >-
ID of the installation for which the app token will be requested.
Defaults to the ID of the repository's installation.
type: string
permissions:
description: >-
JSON-stringified permissions granted to the app token. Defaults to all
the GitHub app permissions, see:
https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app
type: string
github-api-url:
description: Configure github API URL.
type: string
required: false
default: ${{ github.api_url }}
repository:
description: >-
The full name of the repository to operate on in owner/repo format.
Defaults to the current repository.
type: string
default: ${{ github.repository }}
default-branch:
description: >-
Branch to open pull release PR against. Defaults to the repository's
default branch.
type: string
required: false
default: ""
config-file:
description: Pat to config file within the project.
type: string
required: false
default: ".github/release-please-config.json"
manifest-file:
description: Path to manifest file within the project.
type: string
required: false
default: ".github/.release-please-manifest.json"
#
# Outputs
#
outputs:
release_created:
description: "Whether or not a release was created."
value: ${{ jobs.release-please-manifest.outputs.release_created }}
releases_created:
description: "Whether or not a release was created."
value: ${{ jobs.release-please-manifest.outputs.releases_created }}
id:
description: "Release ID."
value: ${{ jobs.release-please-manifest.outputs.id }}
name:
description: "Release name."
value: ${{ jobs.release-please-manifest.outputs.name }}
tag_name:
description: "Release tag name."
value: ${{ jobs.release-please-manifest.outputs.tag_name }}
sha:
description: "Release sha"
value: ${{ jobs.release-please-manifest.outputs.sha }}
body:
description: "Release body."
value: ${{ jobs.release-please-manifest.outputs.body }}
html_url:
description: "Release URL."
value: ${{ jobs.release-please-manifest.outputs.html_url }}
draft:
description: "Whether or not the release is a draft."
value: ${{ jobs.release-please-manifest.outputs.draft }}
upload_url:
description: "Release upload URL."
value: ${{ jobs.release-please-manifest.outputs.upload_url }}
path:
description: "Path that was released."
value: ${{ jobs.release-please-manifest.outputs.path }}
version:
description: "Version that was released."
value: ${{ jobs.release-please-manifest.outputs.version }}
major:
description: "Major version that was released."
value: ${{ jobs.release-please-manifest.outputs.major }}
minor:
description: "Minor version that was released."
value: ${{ jobs.release-please-manifest.outputs.minor }}
patch:
description: "Patch version that was released."
value: ${{ jobs.release-please-manifest.outputs.patch }}
paths_released:
description: "Paths that were released."
value: ${{ jobs.release-please-manifest.outputs.paths_released }}
pr:
description: "Pull request number."
value: ${{ jobs.release-please-manifest.outputs.pr }}
prs:
description: "Pull request numbers."
value: ${{ jobs.release-please-manifest.outputs.prs }}
release-please:
description: "All outputs from release-please action as a JSON string."
value: ${{ jobs.release-please-manifest.outputs.release-please }}
permissions:
contents: write
pull-requests: write
jobs:
release-please-manifest:
runs-on: ${{ inputs.runs_on }}
if: >-
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/master' ||
(
inputs.default-branch != '' &&
github.ref == format('refs/heads/{0}', inputs.default-branch)
)
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}
releases_created: ${{ steps.release-please.outputs.releases_created }}
id: ${{ steps.release-please.outputs.id }}
name: ${{ steps.release-please.outputs.name }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
sha: ${{ steps.release-please.outputs.sha }}
body: ${{ steps.release-please.outputs.body }}
html_url: ${{ steps.release-please.outputs.html_url }}
draft: ${{ steps.release-please.outputs.draft }}
upload_url: ${{ steps.release-please.outputs.upload_url }}
path: ${{ steps.release-please.outputs.path }}
version: ${{ steps.release-please.outputs.version }}
major: ${{ steps.release-please.outputs.major }}
minor: ${{ steps.release-please.outputs.minor }}
patch: ${{ steps.release-please.outputs.patch }}
paths_released: ${{ steps.release-please.outputs.paths_released }}
pr: ${{ steps.release-please.outputs.pr }}
prs: ${{ steps.release-please.outputs.prs }}
release-please: ${{ toJSON(steps.release-please.outputs) }}
steps:
- name: Determine which token to use
id: token
run: |-
echo "token=${GIVEN_TOKEN:-$GITHUB_TOKEN}" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: "${{ github.token }}"
GIVEN_TOKEN: "${{ secrets.token }}"
shell: bash
- uses: jimeh/release-please-manifest-action@v1
id: release-please
with:
token: ${{ steps.token.outputs.token }}
app-id: ${{ secrets.app-id }}
private-key: ${{ secrets.private-key }}
installation-id: ${{ inputs.installation-id }}
permissions: ${{ inputs.permissions }}
github-api-url: ${{ inputs.github-api-url }}
repository: ${{ inputs.repository }}
default-branch: ${{ inputs.default-branch }}
config-file: ${{ inputs.config-file }}
manifest-file: ${{ inputs.manifest-file }}

27
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
---
name: Release
on:
push:
branches:
- main
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: jimeh/release-please-manifest-action@main
id: release
- name: Create/update MAJOR tag
if: ${{ steps.release.outputs.release_created }}
uses: richardsimko/update-tag@v1
with:
tag_name: v${{ steps.release.outputs.major }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create/update MAJOR.MINOR tag
if: ${{ steps.release.outputs.release_created }}
uses: richardsimko/update-tag@v1
with:
tag_name: v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,12 +1,5 @@
# Changelog
## [1.0.2](https://github.com/jimeh/release-please-manifest-action/compare/v1.0.1...v1.0.2) (2023-05-18)
### Bug Fixes
* **action:** correct minor typo in action metadata ([#14](https://github.com/jimeh/release-please-manifest-action/issues/14)) ([f307f17](https://github.com/jimeh/release-please-manifest-action/commit/f307f175b93d8eb1a1a4dfaf9092efaba72a6d62))
## [1.0.1](https://github.com/jimeh/release-please-manifest-action/compare/v1.0.0...v1.0.1) (2023-05-08)

View File

@@ -1,10 +1,3 @@
.PHONY: docs
docs: readme
.PHONY: readme
readme: check-npx action-docs
npx --yes prettier --print-width 80 --prose-wrap always --write README.md
.PHONY: action-docs
action-docs: check-npx
npx --yes action-docs --update-readme

View File

@@ -221,21 +221,18 @@ _Note: Outputs are not included in this equivalence example._
## Inputs
| parameter | description | required | default |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
| token | GitHub token used to authenticate. | `false` | ${{ github.token }} |
| app-id | ID of the GitHub App to use for authentication. If set, takes precedence over token input. | `false` | |
| private-key | Private key of the GitHub App (can be Base64 encoded). Required when app-id is provided. | `false` | |
| installation-retrieval-mode | The mode used to retrieve the installation for which the token will be requested. Must be one of: id, organization, repository, or user. For details see: https://github.com/tibdex/github-app-token | `false` | repository |
| installation-retrieval-payload | The payload used to retrieve the installation. | `false` | ${{ github.repository }} |
| permissions | JSON-stringified permissions granted to the app token. Defaults to all the GitHub app permissions, see: https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app | `false` | |
| github-api-url | Configure github API URL. | `false` | ${{ github.api_url }} |
| target-branch | branch to open pull release PR against (detected by default) | `false` | |
| config-file | Pat to config file within the project. | `false` | .github/release-please-config.json |
| manifest-file | Path to manifest file within the project. | `false` | .github/.release-please-manifest.json |
| path | create a release from a path other than the repository's root | `false` | |
| fork | If true, send the PR from a fork. This requires the token to be a user that can create forks (e.g. not the default GITHUB_TOKEN) | `false` | false |
| proxy-server | Set proxy sever when you run this action behind a proxy. Format is host:port e.g. proxy-host.com:8080 | `false` | |
| parameter | description | required | default |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------- |
| token | GitHub token used to authenticate. | `false` | ${{ github.token }} |
| app-id | ID of the GitHub App to use for authentication. If set, takes precedence over token input. | `false` | |
| private-key | Private key of the GitHub App (can be Base64 encoded). Required when app-id is provided. | `false` | |
| installation-id | ID of the installation for which the app token will be requested. Defaults to the ID of the repository's installation. | `false` | |
| permissions | JSON-stringified permissions granted to the app token. Defaults to all the GitHub app permissions, see: https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app | `false` | |
| github-api-url | Configure github API URL. | `false` | ${{ github.api_url }} |
| repository | The full name of the repository to operate on in owner/repo format. Defaults to the current repository. | `false` | ${{ github.repository }} |
| default-branch | Branch to open pull release PR against. Defaults to the repository's default branch. | `false` | |
| config-file | Pat to config file within the project. | `false` | .github/release-please-config.json |
| manifest-file | Path to manifest file within the project. | `false` | .github/.release-please-manifest.json |
<!-- action-docs-inputs -->
@@ -250,7 +247,7 @@ _Note: Outputs are not included in this equivalence example._
| id | Release ID. |
| name | Release name. |
| tag_name | Release tag name. |
| sha | Release SHA. |
| sha | Release sha |
| body | Release body. |
| html_url | Release URL. |
| draft | Whether or not the release is a draft. |

View File

@@ -4,11 +4,13 @@ description: >-
Opinionated action for running release-please in manifest mode with optional
support to authenticate as a GitHub App.
author: "jimeh"
inputs:
token:
description: "GitHub token used to authenticate."
description: >-
GitHub token used to authenticate.
required: false
default: "${{ github.token }}"
default: ${{ github.token }}
app-id:
description: >-
ID of the GitHub App to use for authentication. If set, takes precedence
@@ -19,53 +21,38 @@ inputs:
Private key of the GitHub App (can be Base64 encoded). Required when
app-id is provided.
required: false
installation-retrieval-mode:
installation-id:
description: >-
The mode used to retrieve the installation for which the token will be
requested. Must be one of: id, organization, repository, or user. For
details see: https://github.com/tibdex/github-app-token
default: "repository"
installation-retrieval-payload:
description: "The payload used to retrieve the installation."
default: "${{ github.repository }}"
ID of the installation for which the app token will be requested. Defaults
to the ID of the repository's installation.
permissions:
description: >-
JSON-stringified permissions granted to the app token. Defaults to all the
GitHub app permissions, see:
https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app
github-api-url:
description: "Configure github API URL."
description: Configure github API URL.
required: false
default: "${{ github.api_url }}"
target-branch:
description: "Branch to open pull release PR against (detected by default)"
default: ${{ github.api_url }}
repository:
description: >-
The full name of the repository to operate on in owner/repo format.
Defaults to the current repository.
default: ${{ github.repository }}
default-branch:
description: >-
Branch to open pull release PR against. Defaults to the repository's
default branch.
required: false
default: ""
config-file:
description: "Pat to config file within the project."
description: Pat to config file within the project.
required: false
default: ".github/release-please-config.json"
manifest-file:
description: "Path to manifest file within the project."
description: Path to manifest file within the project.
required: false
default: ".github/.release-please-manifest.json"
path:
description: >-
Create a release from a path other than the repository's root.
required: false
default: ""
fork:
description: >-
If true, send the PR from a fork. This requires the token to be a user
that can create forks (e.g. not the default GITHUB_TOKEN)
required: false
default: "false"
proxy-server:
description: >-
Set proxy sever when you run this action behind a proxy. Format is
host:port e.g. proxy-host.com:8080
required: false
default: ""
outputs:
release_created:
@@ -84,7 +71,7 @@ outputs:
description: "Release tag name."
value: ${{ steps.release-please.outputs.tag_name }}
sha:
description: "Release SHA."
description: "Release sha"
value: ${{ steps.release-please.outputs.sha }}
body:
description: "Release body."
@@ -129,17 +116,17 @@ outputs:
runs:
using: "composite"
steps:
- uses: tibdex/github-app-token@v2
- uses: tibdex/github-app-token@v1
if: inputs.app-id != null && inputs.app-id != ''
id: github-app-token
with:
app_id: ${{ inputs.app-id }}
installation_retrieval_mode: ${{ inputs.installation-retrieval-mode }}
installation_retrieval_payload: ${{ inputs.installation-retrieval-payload }}
installation_id: ${{ inputs.installation-id }}
github_api_url: ${{ inputs.github-api-url }}
permissions: ${{ inputs.permissions }}
private_key: ${{ inputs.private-key }}
- name: resolve token
repository: ${{ github.repository }}
- name: Determine which token to use
id: token
run: |-
echo "token=${APP_TOKEN:-$INPUT_TOKEN}" >> "$GITHUB_OUTPUT"
@@ -147,16 +134,14 @@ runs:
APP_TOKEN: "${{ steps.github-app-token.outputs.token }}"
INPUT_TOKEN: "${{ inputs.token }}"
shell: bash
- uses: google-github-actions/release-please-action@v4
- uses: google-github-actions/release-please-action@v3
id: release-please
with:
command: manifest
token: ${{ steps.token.outputs.token }}
target-branch: ${{ inputs.target-branch }}
path: ${{ inputs.path }}
default-branch: ${{ inputs.default-branch }}
config-file: ${{ inputs.config-file }}
manifest-file: ${{ inputs.manifest-file }}
github-api-url: ${{ inputs.github-api-url }}
github-graphql-url: ${{ inputs.github-api-url }}
repo-url: ${{ inputs.repository }}
fork: ${{ inputs.fork }}
proxy-server: ${{ inputs.proxy-server }}