diff --git a/.github/workflows/build-pr-artifacts.yml b/.github/workflows/build-pr-artifacts.yml new file mode 100644 index 0000000..8e8554e --- /dev/null +++ b/.github/workflows/build-pr-artifacts.yml @@ -0,0 +1,37 @@ +name: Build Artifacts for PRs + +on: + pull_request: + types: + - opened + - reopened + - synchronize + +jobs: + generate-tag: + name: Generate docker tag + runs-on: ubuntu-latest + outputs: + image_tag: ${{steps.gen_tag_names.outputs.tag_name}} + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 1 + + # Replace problematic characters in branch name (like '/') with safe characters (like '.') + - name: Generate Tag Names + id: gen_tag_names + run: | + tag_name=$(echo ${{ github.head_ref }} | tr "/" .) + echo "Tag Name: $tag_name" + echo "tag_name=$tag_name" >> $GITHUB_OUTPUT + build: + name: Build Shopify Tracker Docker Image + uses: ./.github/workflows/build-and-push-docker-image.yml + needs: [generate-tag] + with: + img_tag: ${{ needs.generate-tag.outputs.image_tag }} + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml index a6171e2..f09d379 100644 --- a/.github/workflows/draft-new-release.yml +++ b/.github/workflows/draft-new-release.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest # Only allow release stakeholders to initiate releases - if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'utsabc' || github.actor == 'shrouti1507') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'utsabc' || github.triggering_actor == 'shrouti1507') + if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'utsabc' || github.actor == 'shrouti1507') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'utsabc' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'sanpj2292') steps: - name: Checkout uses: actions/checkout@v4.1.0 diff --git a/Dockerfile b/Dockerfile index 3043ba6..4e29901 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ COPY package*.json ./ COPY . . RUN rm -rf /usr/src/app/node_modules -RUN npm install --only=prod +RUN npm ci --no-audit --cache .npm # If you are building your code for production # RUN npm ci --only=production