-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from smlx/action
feat: turn repository into a Github action
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 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,10 @@ | ||
FROM alpine:3.20 | ||
RUN apk --no-cache add curl git jq \ | ||
&& (if echo "$TARGETPLATFORM" | grep -q arm; then \ | ||
curl -sSL $(curl -s https://api.github.com/repos/smlx/ccv/releases/latest | jq -r '.assets[].browser_download_url | select(test("linux_arm64"))'); \ | ||
else \ | ||
curl -sSL $(curl -s https://api.github.com/repos/smlx/ccv/releases/latest | jq -r '.assets[].browser_download_url | select(test("linux_amd64"))'); \ | ||
fi) \ | ||
| tar -xz -C /usr/local/bin ccv | ||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
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,10 @@ | ||
name: Conventional Commits Versioner Action | ||
description: Automatically tag a new version based on the commit messages of commits since the last tag. | ||
outputs: | ||
new_tag: | ||
description: Either "true" or "false" depending on whether a new tag was pushed. | ||
new_tag_version: | ||
description: The new version that was tagged. This will only be set if new_tag=true. | ||
runs: | ||
using: docker | ||
image: Dockerfile |
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,14 @@ | ||
#!/bin/sh | ||
set -eu | ||
# https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action#accessing-files-created-by-a-container-action | ||
cd /github/workspace | ||
# if the ccv tag exists, just exit | ||
if [ "$(git tag -l "$(ccv)")" ]; then | ||
echo "new_tag=false" >>"$GITHUB_OUTPUT" | ||
exit | ||
fi | ||
# if it doesn't, tag and push | ||
git tag "$(ccv)" | ||
git push --tags | ||
echo "new_tag=true" >>"$GITHUB_OUTPUT" | ||
echo "new_tag_version=$(git tag --points-at HEAD)" >>"$GITHUB_OUTPUT" |