-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Use latest alpine image as base | ||
FROM alpine:latest | ||
|
||
# Copy needed stuff into container | ||
COPY LICENSE README.md / | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
# Install some packages | ||
RUN apk add jq bash git go | ||
RUN apk add --no-cache --upgrade grep | ||
|
||
# Start action | ||
ENTRYPOINT ["/entrypoint.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: "PTerm Release" | ||
description: "Creates a new release if the PTerm version has changed in a commit." | ||
author: "MarvinJWendt" | ||
branding: | ||
icon: award | ||
color: orange | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
args: | ||
- ${{ inputs.myInput }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
REPO_FULLNAME=$(jq -r ".repository.full_name" "$GITHUB_EVENT_PATH") | ||
|
||
echo "## Initializing git repo..." | ||
git init | ||
echo "### Adding git remote..." | ||
git remote add origin https://x-access-token:$ACCESS_TOKEN@github.com/$REPO_FULLNAME.git | ||
echo "### Getting branch" | ||
BRANCH=${GITHUB_REF#*refs/heads/} | ||
|
||
if [[ $BRANCH == refs/tags* ]]; then | ||
echo "## The push was a tag, aborting!" | ||
exit | ||
fi | ||
|
||
echo "### git fetch $BRANCH ..." | ||
git fetch origin $BRANCH | ||
echo "### Branch: $BRANCH (ref: $GITHUB_REF )" | ||
git checkout $BRANCH | ||
|
||
echo "## Login into git..." | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "MarvinJWendt" | ||
|
||
echo "## Ignore workflow files (we may not touch them)" | ||
git update-index --assume-unchanged .github/workflows/* | ||
|
||
# Start release | ||
|
||
git fetch --tags | ||
|
||
echo "## Detecting current version of dops" | ||
OLD_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
echo "## $OLD_VERSION" | ||
|
||
NEW_VERSION=$(cat pterm.go | grep "<---VERSION--->" | grep -oP "v\d*\.\d*\.\d*") | ||
|
||
echo "## Version in commit detected: $NEW_VERSION!" | ||
|
||
if [ "$OLD_VERSION" = "$NEW_VERSION" ]; then | ||
echo "## Version did not change. Aborting!" | ||
else | ||
echo "## Version change detected!" | ||
|
||
git tag "$NEW_VERSION" | ||
|
||
echo "## Staging changes..." | ||
git add . | ||
echo "## Commiting files..." | ||
git commit -m "ci: release new version" || true | ||
echo "## Pushing to $BRANCH" | ||
git push -u origin $BRANCH --tags | ||
fi |