forked from defenseunicorns/pkg
-
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.
- Loading branch information
1 parent
bece5ed
commit 9a3cadc
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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,51 @@ | ||
name: Release Package | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
packageName: | ||
description: "Go Sub-Package Name" | ||
required: true | ||
version: | ||
description: "Version (Include v)" | ||
required: true | ||
|
||
jobs: | ||
tag-and-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
- name: Validate Package Name | ||
run: | | ||
PACKAGE_NAME=${{ github.event.inputs.packageName }} | ||
MODULES=$(find . -type f -name 'go.mod' -exec dirname {} \; | cut -c 3-) | ||
if ! echo "$MODULES" | grep "$PACKAGE_NAME"; then | ||
echo "Error: Package name '$PACKAGE_NAME' does not match any Go sub-package in the repository." | ||
echo "Valid packages: $MODULES" | ||
exit 1 | ||
fi | ||
- name: Tag Release | ||
run: | | ||
PACKAGE_NAME=${{ github.event.inputs.packageName }} | ||
VERSION=${{ github.event.inputs.version }} | ||
TAG="${PACKAGE_NAME}/${VERSION}" | ||
git tag $TAG | ||
git push origin $TAG | ||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.event.inputs.packageName }}/${{ github.event.inputs.version }} | ||
release_name: Release ${{ github.event.inputs.packageName }}/${{ github.event.inputs.version }} | ||
draft: false | ||
prerelease: false |
File renamed without changes.
File renamed without changes.