Fix create release pipeline #22
Workflow file for this run
This file contains hidden or 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: Merge PR | |
| on: | |
| pull_request: | |
| types: | |
| - closed | |
| branches: | |
| - main | |
| concurrency: | |
| group: merge | |
| cancel-in-progress: false | |
| jobs: | |
| merge: | |
| name: Merge PR | |
| runs-on: self-hosted-hoprnet-big | |
| if: github.event.pull_request.merged == true | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: hoprnet/hopr-workflows/actions/setup-node-js@master | |
| with: | |
| node-version: 22.x | |
| - name: Setup GCP | |
| id: gcp | |
| uses: hoprnet/hopr-workflows/actions/setup-gcp@master | |
| with: | |
| google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }} | |
| login-artifact-registry: 'true' | |
| - name: Unpublish PR commit versions | |
| run: | | |
| gcloud artifacts versions list --repository=npm --location=europe-west3 --project=hoprassociation --package="${{ vars.NPM_PACKAGE_NAME }}" --format=json 2> /dev/null | jq -r ' .[] | select(.name | contains("-pr.${{ github.event.pull_request.number }}-")).name' | sed 's/.*versions\///g' > pr_commit_versions.txt | |
| while read -r version; do | |
| echo "Unpublishing commit version: $version" | |
| gcloud artifacts versions delete --delete-tags --quiet --repository=npm --location=europe-west3 --project=hoprassociation --package "${{ vars.NPM_PACKAGE_NAME }}" $version | |
| done < pr_commit_versions.txt | |
| - name: Publish alpha version | |
| run: | | |
| BUILD_DATE=$(date +%Y%m%d%H%M%S) | |
| PR_VERSION=$(jq -r '.version' package.json)-pr.${{ github.event.pull_request.number }} | |
| jq --arg version "${PR_VERSION}-${BUILD_DATE}" '.version = $version' package.json > temp.json | |
| mv temp.json package.json | |
| yarn build | |
| npm run login | |
| yarn publish --registry=https://europe-west3-npm.pkg.dev/hoprassociation/npm/ --no-git-tag-version --tag next | |
| jq --arg version "${PR_VERSION}" '.version = $version' package.json > temp.json | |
| mv temp.json package.json | |
| yarn publish --registry=https://europe-west3-npm.pkg.dev/hoprassociation/npm/ --no-git-tag-version --tag alpha | |
| env: | |
| NODE_AUTH_TOKEN: ${{ steps.gcp.outputs.access_token }} |