77 branches :
88 - develop
99 - main
10+ - eu1
11+ - na2
1012
1113jobs :
1214 develop :
4547 npm dist-tag add polyapi@$VERSION latest
4648 fi
4749
48-
4950 main :
5051 name : Tagging of develop package
5152 runs-on : ubuntu-latest
7576 npm dist-tag add polyapi@$VERSION develop
7677 fi
7778
79+ na2 :
80+ name : Tagging of develop package
81+ runs-on : ubuntu-latest
82+ if : ${{ github.event.pull_request.head.ref == 'main' && github.event.pull_request.base.ref == 'na2' && github.event.pull_request.merged == true }}
83+ env :
84+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
85+
86+
87+ steps :
88+ - uses : actions/checkout@v3
89+
90+ - name : Setup Node
91+ uses : actions/setup-node@v2
92+ with :
93+ node-version : ' 18'
94+ registry-url : ' https://registry.npmjs.org'
95+
96+
97+ - name : Publish package
98+ run : |
99+ VERSION=$(node -p "require('./package.json').version")
100+ VERSIONREMOTE=$(npm view polyapi --json | jq -r '.["dist-tags"].na2')
101+
102+ if [[ $VERSION == $VERSIONREMOTE ]]; then
103+ echo "Repository NPM version it's the same that develop on registry"
104+ else
105+ npm dist-tag add polyapi@$VERSION na2
106+ fi
107+
108+ eu1 :
109+ name : Tagging of develop package
110+ runs-on : ubuntu-latest
111+ if : ${{ github.event.pull_request.head.ref == 'main' && github.event.pull_request.base.ref == 'eu1' && github.event.pull_request.merged == true }}
112+ env :
113+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
114+
115+
116+ steps :
117+ - uses : actions/checkout@v3
118+
119+ - name : Setup Node
120+ uses : actions/setup-node@v2
121+ with :
122+ node-version : ' 18'
123+ registry-url : ' https://registry.npmjs.org'
124+
125+
126+ - name : Publish package
127+ run : |
128+ VERSION=$(node -p "require('./package.json').version")
129+ VERSIONREMOTE=$(npm view polyapi --json | jq -r '.["dist-tags"].eu1')
130+
131+ if [[ $VERSION == $VERSIONREMOTE ]]; then
132+ echo "Repository NPM version it's the same that develop on registry"
133+ else
134+ npm dist-tag add polyapi@$VERSION eu1
135+ fi
136+
137+
138+
78139 other-branch :
79140 name : NPM build and push.
80141 runs-on : ubuntu-latest
83144 env :
84145 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
85146
86-
87147 steps :
88148 - uses : actions/checkout@v3
89149
@@ -123,4 +183,4 @@ jobs:
123183 echo "Local NPM version is the same as remote"
124184 else
125185 npm dist-tag add polyapi@$VERSION latest
126- fi
186+ fi
0 commit comments