From 651bf8c28690a923315632b4b6589f3c66813eea Mon Sep 17 00:00:00 2001 From: Sahil Ahuja Date: Wed, 29 Jan 2025 18:18:19 +0530 Subject: [PATCH] initial commit --- .editorconfig | 8 +++++ .github/README.md | 0 .github/workflows/container-push.yml | 50 ++++++++++++++++++++++++++++ .github/workflows/lint-and-check.yml | 28 ++++++++++++++++ LICENSE | 21 ++++++++++++ README.md | 10 ++++++ 6 files changed, 117 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/README.md create mode 100644 .github/workflows/container-push.yml create mode 100644 .github/workflows/lint-and-check.yml create mode 100644 LICENSE diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f07d394 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +indent_style = space + +[*.{js,jsx,ts,tsx,py,sh,md,gql,graphql,yaml,yml,json,sql,njk,scss,css}] +indent_style = space +indent_size = 2 diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/container-push.yml b/.github/workflows/container-push.yml new file mode 100644 index 0000000..a9f7221 --- /dev/null +++ b/.github/workflows/container-push.yml @@ -0,0 +1,50 @@ +name: Reusable container push workflow + +on: + workflow_call: + +env: + REPO: ${{ github.repository }} + +jobs: + container-push: + runs-on: ubuntu-22.04 + steps: + - id: get-id + name: Get a unique tag for this build + run: | + SHA=${{ github.sha }}; BRANCH_NAME=${{ github.base_ref || github.ref_name }}; + BUILD_ID=$BRANCH_NAME-${SHA:0:8}; + DOCKER_IMAGE=${{ vars.docker_repo2_registry }}/$REPO:$BUILD_ID; + echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT"; + echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> "$GITHUB_OUTPUT"; + + - name: Print build id and image name + run: | + echo "BUILD_ID: ${{ steps.get-id.outputs.BUILD_ID }}"; + echo "DOCKER_IMAGE: ${{ steps.get-id.outputs.DOCKER_IMAGE }}"; + + - uses: actions/checkout@v4 + + - name: Login to docker container registry + uses: docker/login-action@v3 + with: + registry: ${{ vars.docker_repo2_registry }} + username: ${{ vars.docker_repo2_username }} + password: ${{ vars.docker_repo2_password }} + + - name: Build the container image + run: | + docker build \ + --build-arg PUBLIC_BUILD_VERSION=${{ steps.get-id.outputs.BUILD_ID }} \ + --file fab/d/actions-build.Dockerfile \ + --tag ${{ steps.get-id.outputs.DOCKER_IMAGE }} \ + .; + + - name: Container details + run: | + IMAGE_SIZE=`docker inspect -f "{{ .Size }}" ${{ steps.get-id.outputs.DOCKER_IMAGE }} | numfmt --to=si`; + echo "$IMAGE_SIZE container ${{ steps.get-id.outputs.DOCKER_IMAGE }}"; + + - name: Push the container image + run: docker push ${{ steps.get-id.outputs.DOCKER_IMAGE }} diff --git a/.github/workflows/lint-and-check.yml b/.github/workflows/lint-and-check.yml new file mode 100644 index 0000000..6992a36 --- /dev/null +++ b/.github/workflows/lint-and-check.yml @@ -0,0 +1,28 @@ +name: NPM Link and check resuable workflow + +on: + workflow_call: + +env: + REPO: ${{ github.repository }}/temp #Add /temp for PR workflow + +jobs: + + lint-and-check: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: ${{ vars.NPM_REGISTRY }} + token: ${{ secrets.NPM_TOKEN }} + + - name: Install npm dependencies + run: | + npm install -g pnpm + pnpm install + + - run: pnpm lint + - run: pnpm check diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d954a11 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 GMetri XR + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index eb965bc..3200d46 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # deploy-tools +Github Action Workflows that can be reused, built by GMetri + +## Creating new releases + +``` +git add -A; +git commit -m "" +git tag -a -m "" v1.3 +git push --follow-tags +```