diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml new file mode 100644 index 0000000000..3f99ece65c --- /dev/null +++ b/.github/workflows/master.yaml @@ -0,0 +1,47 @@ +name: workflow for Master +on: + push: + branches: + - "master" +jobs: + build: + runs-on: ubicloud-standard-2 + permissions: + contents: read + id-token: write + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + node-version: '20' + + - id: 'auth-spotdraft-qa' + name: 'Authenticate to Google Cloud' + uses: 'google-github-actions/auth@v1.1.1' + with: + token_format: 'access_token' + workload_identity_provider: 'projects/400887723303/locations/global/workloadIdentityPools/github-actions-pool/providers/github-provider' + service_account: 'github-actions@spotdraft-qa.iam.gserviceaccount.com' + + - name: Set up gcloud CLI + uses: google-github-actions/setup-gcloud@v3 + with: + project_id: 'spotdraft-qa' + + - name: Configure NPM to use Artifact Registry + run: | + TOKEN=$(gcloud auth print-access-token) + rm -rf .npmrc + echo -e "\n//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=\"$TOKEN\"" >> .npmrc + echo "@spotdraft:registry=https://asia-south1-npm.pkg.dev/spotdraft-qa/npm/" >> .npmrc + + - name: Install dependencies + run: npm install + + - name: Publish package + run: | + npm publish \ No newline at end of file diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000000..a89633e87a --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,47 @@ +name: workflow for PR +on: + pull_request: + types: [opened, synchronize, reopened] + branches: [master] +jobs: + build: + runs-on: ubicloud-standard-2 + permissions: + contents: read + id-token: write + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + node-version: '24' + + - id: 'auth-spotdraft-qa' + name: 'Authenticate to Google Cloud' + uses: 'google-github-actions/auth@v1.1.1' + with: + token_format: 'access_token' + workload_identity_provider: 'projects/400887723303/locations/global/workloadIdentityPools/github-actions-pool/providers/github-provider' + service_account: 'github-actions@spotdraft-qa.iam.gserviceaccount.com' + + - name: Set up gcloud CLI + uses: google-github-actions/setup-gcloud@v3 + with: + project_id: 'spotdraft-qa' + + - name: Configure NPM to use Artifact Registry + run: | + TOKEN=$(gcloud auth print-access-token) + rm -rf .npmrc + echo -e "\n//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=\"$TOKEN\"" >> .npmrc + echo "@spotdraft:registry=https://asia-south1-npm.pkg.dev/spotdraft-qa/npm/" >> .npmrc + + - name: Install dependencies + run: npm install + + - name: Publish package + run: | + npm publish --dry-run \ No newline at end of file diff --git a/package.json b/package.json index 2cffc26250..1d2564a0dd 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "liquidjs", + "name": "@spotdraft/liquidjs", "version": "3.1.0", "description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.", "main": "index.js",