From 19dd8f0430ce39dfd160f190f7125639cf37168e Mon Sep 17 00:00:00 2001 From: Bryce Thorup Date: Thu, 5 Mar 2026 07:14:39 -0700 Subject: [PATCH] v2 --- .gitea/workflows/push_to_main.yaml | 6 +++--- action.js | 19 +++++++++++++++++++ action.sh | 13 ------------- action.yaml | 5 +---- 4 files changed, 23 insertions(+), 20 deletions(-) create mode 100644 action.js delete mode 100755 action.sh diff --git a/.gitea/workflows/push_to_main.yaml b/.gitea/workflows/push_to_main.yaml index d4b219c..46f693e 100644 --- a/.gitea/workflows/push_to_main.yaml +++ b/.gitea/workflows/push_to_main.yaml @@ -10,7 +10,7 @@ jobs: 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 tag -d v2 || true + - run: git push --delete origin v2 || true + - run: git tag v2 - run: git push --tags diff --git a/action.js b/action.js new file mode 100644 index 0000000..01d3589 --- /dev/null +++ b/action.js @@ -0,0 +1,19 @@ +import { execSync, readFileSync } from "fs"; + +const tag = JSON.parse( + readFileSync("package.json", { encoding: "utf8" }), +).version; + +console.log("============= INSTALLING DOCKER =============="); +execSync("curl -fsSL https://get.docker.com -o get-docker.sh"); +execSync("sh get-docker.sh"); +execSync("rm get-docker.sh"); + +console.log("======== LOGGING IN TO CONTAINER REPO ========"); +execSync( + "docker login $INPUT_CONTAINER_DOMAIN -u $INPUT_LOGIN_USER --password $INPUT_LOGIN_PASS", +); +execSync( + `docker build -t $INPUT_CONTAINER_DOMAIN/$INPUT_CONTAINER_NAME:${tag} --no-cache .`, +); +execSync(`docker push $INPUT_CONTAINER_DOMAIN/$INPUT_CONTAINER_NAME:${tag}`); diff --git a/action.sh b/action.sh deleted file mode 100755 index 9bb8566..0000000 --- a/action.sh +++ /dev/null @@ -1,13 +0,0 @@ -### INSTALL DOCKER -echo "get docker install script" -curl -fsSL https://get.docker.com -o get-docker.sh -echo "run docker install script" -sh get-docker.sh - -### LOGIN TO CONTAINER REPO -echo "run docker login" -docker login $INPUT_CONTAINER_DOMAIN -u $INPUT_LOGIN_USER --password $INPUT_LOGIN_PASS -echo "run docker build" -docker build -t $INPUT_CONTAINER_DOMAIN/$INPUT_CONTAINER_NAME:$INPUT_CONTAINER_TAG --no-cache . -echo "run docker push" -docker push $INPUT_CONTAINER_DOMAIN/$INPUT_CONTAINER_NAME:$INPUT_CONTAINER_TAG \ No newline at end of file diff --git a/action.yaml b/action.yaml index 00dc4b2..da95cf5 100644 --- a/action.yaml +++ b/action.yaml @@ -14,11 +14,8 @@ inputs: container_name: description: container name (org/package) required: true - container_tag: - description: container tag (latest) - required: true runs: using: "composite" steps: - - run: $GITHUB_ACTION_PATH/action.sh + - run: node $GITHUB_ACTION_PATH/action.js shell: bash