-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check input directory for empty repositories
- Loading branch information
1 parent
0d29f75
commit 2bec266
Showing
6 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Prepare Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: The released CLI version without 'v'. For example, 1.0.0. | ||
permissions: | ||
contents: write | ||
env: | ||
APP_ID: 257262 | ||
jobs: | ||
draft_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Validate input version | ||
if: ${{ startsWith(github.event.inputs.version, 'v') }} | ||
run: | | ||
echo "error: version must not start with 'v'." | ||
exit 1 | ||
- name: Set VERSION variable | ||
# The head ref looks like release/v1.0.0, and we need to trim the string up to the `/v`. | ||
run: | | ||
VERSION="${{ github.event.inputs.version || github.head_ref}}" | ||
echo "VERSION=${VERSION##*/v}" >> $GITHUB_ENV | ||
- name: Get GitHub app token | ||
uses: actions/create-github-app-token@v1 | ||
id: app_token | ||
with: | ||
app-id: ${{ env.APP_ID }} | ||
private-key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | ||
- name: Checkout repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.app_token.outputs.token }} | ||
fetch-depth: 0 | ||
- name: Sync v1 branch | ||
run: | | ||
git fetch origin | ||
git switch v1 | ||
git merge origin/main | ||
git push origin v1 | ||
- name: Release | ||
run: gh release create --draft --title "v${VERSION}" "v${VERSION}" | ||
env: | ||
GH_TOKEN: ${{ steps.app_token.outputs.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Draft Release | ||
on: | ||
pull_request: | ||
types: [closed] | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: The released CLI version without 'v'. For example, 1.0.0. | ||
permissions: | ||
contents: write | ||
env: | ||
APP_ID: 257262 | ||
jobs: | ||
draft_release: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release')) }} | ||
steps: | ||
- name: Validate input version | ||
if: ${{ startsWith(github.event.inputs.version, 'v') }} | ||
run: | | ||
echo "error: version must not start with 'v'." | ||
exit 1 | ||
- name: Set VERSION variable | ||
# The head ref looks like release/v1.0.0, and we need to trim the string up to the `/v`. | ||
run: | | ||
VERSION="${{ github.event.inputs.version || github.head_ref}}" | ||
echo "VERSION=${VERSION##*/v}" >> $GITHUB_ENV | ||
- name: Get GitHub app token | ||
uses: actions/create-github-app-token@v1 | ||
id: app_token | ||
with: | ||
app-id: ${{ env.APP_ID }} | ||
private-key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | ||
- name: Checkout repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.app_token.outputs.token }} | ||
fetch-depth: 0 | ||
- name: Sync v1 branch | ||
run: | | ||
git fetch origin | ||
git switch v1 | ||
git merge origin/main | ||
git push origin v1 | ||
- name: Release | ||
run: gh release create --draft --title "v${VERSION}" "v${VERSION}" | ||
env: | ||
GH_TOKEN: ${{ steps.app_token.outputs.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters