Skip to content

Commit

Permalink
Merge pull request #3 from urbanmedia/feature/TSPDE-890-remove-manual…
Browse files Browse the repository at this point in the history
…-github-release-creation-steps-trigger

Adds new optional CREATE_RELEASE param
  • Loading branch information
iheredia authored Apr 19, 2024
2 parents d0378da + 825d9d2 commit c8743e0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 11 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/github-tag-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@master
with:
fetch-depth: "0"
- name: Bump version and push tag
uses: urbanmedia/github-tag-action@tmp_master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CREATE_RELEASE: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ COPY ./contrib/semver ./contrib/semver
RUN install ./contrib/semver /usr/local/bin
COPY entrypoint.sh /entrypoint.sh

RUN apk update && apk add bash git curl jq
RUN apk update && apk add bash git curl jq github-cli

ENTRYPOINT ["/entrypoint.sh"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ _NOTE: set the fetch-depth for `actions/checkout@master` to be sure you retrieve
* **CUSTOM_TAG** *(optional)* - Set a custom tag, useful when generating tag based on f.ex FROM image in a docker image. **Setting this tag will invalidate any other settings set!**
* **SOURCE** *(optional)* - Operate on a relative path under $GITHUB_WORKSPACE.
* **DRY_RUN** *(optional)* - Determine the next version without tagging the branch. The workflow can use the outputs `new_tag` and `tag` in subsequent steps. Possible values are ```true``` and ```false``` (default).
* **CREATE_RELEASE** *(optional)* - Creates a release pointing to the newly created tag, with notes automatically generated by github

#### Outputs

Expand Down
27 changes: 24 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ release_branches=${RELEASE_BRANCHES:-master}
custom_tag=${CUSTOM_TAG}
source=${SOURCE:-.}
dryrun=${DRY_RUN:-false}
create_release=${CREATE_RELEASE:-false}

# see https://github.blog/2022-04-12-git-security-vulnerability-announced/
git config --global --add safe.directory /github/workspace
Expand Down Expand Up @@ -128,9 +129,29 @@ EOF

if [ $? -eq 0 ]
then
echo "Success"
exit 0
echo "Tag created successfully"
else
echo "curl failed" >&2
echo "Error while creating tag" >&2
exit 1
fi

if $create_release
then
gh release create "${new}" \
--repo="$GITHUB_REPOSITORY" \
--title="${new}" \
--generate-notes \
--notes-start-tag="${tag}";
else
echo "Skipping release creation"
exit 0;
fi

if [ $? -eq 0 ]
then
echo "Release created successfully"
exit 0;
else
echo "Error while creating release" >&2
exit 1
fi

0 comments on commit c8743e0

Please sign in to comment.