From 0ce2400f55767dfb10754a2cb9220780e095c442 Mon Sep 17 00:00:00 2001 From: Bryce Thorup Date: Mon, 1 Jan 2024 16:09:23 -0700 Subject: [PATCH] init --- .gitea/workflows/push_to_main.yaml | 16 ++++++++++++++++ action.sh | 13 +++++++++++++ action.yaml | 8 ++++++++ 3 files changed, 37 insertions(+) create mode 100644 .gitea/workflows/push_to_main.yaml create mode 100755 action.sh create mode 100644 action.yaml diff --git a/.gitea/workflows/push_to_main.yaml b/.gitea/workflows/push_to_main.yaml new file mode 100644 index 0000000..d4b219c --- /dev/null +++ b/.gitea/workflows/push_to_main.yaml @@ -0,0 +1,16 @@ +name: Push to main + +on: + push: + branches: [main] + +jobs: + Reset-Version-Tag: + runs-on: debian-bullseye + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: git tag -d v1 || true + - run: git push --delete origin v1 || true + - run: git tag v1 + - run: git push --tags diff --git a/action.sh b/action.sh new file mode 100755 index 0000000..416b1e9 --- /dev/null +++ b/action.sh @@ -0,0 +1,13 @@ +apt update +apt install jq -y +CURRENT_VERSION=$(jq -r .version package.json) +echo $CURRENT_VERSION +PREVIOUS_VERSIONS=$(git tag -l) +echo $PREVIOUS_VERSIONS +# yo + +if [[ $PREVIOUS_VERSIONS == *$CURRENT_VERSION* ]]; +then + echo "Version $CURRENT_VERSION already tagged in this repository. Be sure to update version number, or delete existing tag." + return 1 +fi diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..ac16491 --- /dev/null +++ b/action.yaml @@ -0,0 +1,8 @@ +name: version-tag +description: "Creates a version tag when the 'version' value in 'package.json' has changed and a tag with the version number does not already exist." +author: "Bryce Thorup" +runs: + using: "composite" + steps: + - run: $GITHUB_ACTION_PATH/action.sh + shell: bash