updated workflows files #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to Artifact Registry on PR Close | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- main | |
jobs: | |
Check-status-pull-request: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
steps: | |
- name: Message of aprove | |
run: echo "Pull Request Aproved, Initialize new version" | |
Type-pull-request: | |
runs-on: ubuntu-latest | |
needs: Check-status-pull-request | |
if: contains(github.event.pull_request.title, 'fix:') | |
steps: | |
- name: Checks if is a Patch Version | |
run: echo "New Patch Version Aproved" | |
Publish-NPM-Package: | |
runs-on: ubuntu-latest | |
needs: Type-pull-request | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Fetch all tags | |
run: git fetch --tags --force | |
- name: Get Latest Tag | |
id: get_new_tag | |
run: | | |
LATEST_TAG=$(git tag --sort=-creatordate | head -n 1) | |
echo "LATEST_TAG=${LATEST_TAG}" | |
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GCP_JSON_AUTH }} | |
- name: Configure NPM for Artifact Registry | |
run: | | |
TOKEN=$(gcloud auth print-access-token) | |
echo "//us-central1-npm.pkg.dev/pch-main/pch-npm-private/:_authToken=${TOKEN}" > ~/.npmrc | |
echo "@pch-private:registry=https://us-central1-npm.pkg.dev/pch-main/pch-npm-private/" >> ~/.npmrc | |
echo "registry=https://registry.npmjs.org/" >> ~/.npmrc | |
- name: Install dependencies | |
run: npm install | |
- name: Build Package | |
run: npm run build | |
# Actualizar la versión del paquete | |
- name: Bump package version to latest tag | |
run: | | |
npm version ${LATEST_TAG} --no-git-tag-version | |
- name: Publish Package to Artifact Registry | |
run: | | |
npm publish --registry=https://us-central1-npm.pkg.dev/pch-main/pch-npm-private/ |