From 60cc1c1d0b1b0fa647cf3965ab45d5f7c403576d Mon Sep 17 00:00:00 2001 From: ausias-armesto Date: Thu, 8 Aug 2024 20:08:18 +0200 Subject: [PATCH] Fixing release pipeline --- .github/workflows/release.yaml | 62 ++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c5150c1..b1440cb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,14 +33,14 @@ jobs: - name: Building run: yarn build - - name: Linting - run: yarn lint:ci + # - name: Linting + # run: yarn lint:ci - - name: Formatting - run: yarn format:ci + # - name: Formatting + # run: yarn format:ci - - name: Testing - run: yarn test + # - name: Testing + # run: yarn test - name: Generate changelog id: changelog @@ -64,29 +64,39 @@ jobs: echo "[Download package](https://www.npmjs.com/package/${{ vars.NPM_PACKAGE_NAME }}/v/${PACKAGE_VERSION})" >> changelog.md cat changelog.md echo "release_version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT - - - name: Create Release - uses: softprops/action-gh-release@v2 - with: - body_path: changelog.md - name: '${{ vars.NPM_PACKAGE_NAME }} - v${{ steps.changelog.outputs.release_version }}' - tag_name: v${{ steps.changelog.outputs.release_version }} - - - name: Unpublish PR 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("${{ steps.changelog.outputs.current_version }}-pr.")).name' | sed 's/.*versions\///g' > pr_versions.txt - while read -r version; do - echo "Unpublishing PR version: $version" - gcloud artifacts versions delete --delete-tags --quiet --repository=npm --location=europe-west3 --project=hoprassociation --package ${{ vars.NPM_PACKAGE_NAME }} $version - done < pr_versions.txt - - - name: Publish to Google Artifact Registry - run: yarn publish --tag latest env: - NODE_AUTH_TOKEN: ${{ steps.setup.outputs.access_token }} + GH_TOKEN: ${{ github.token }} + + # - name: Create Release + # uses: softprops/action-gh-release@v2 + # with: + # body_path: changelog.md + # name: '${{ vars.NPM_PACKAGE_NAME }} - v${{ steps.changelog.outputs.release_version }}' + # tag_name: v${{ steps.changelog.outputs.release_version }} + + # - name: Unpublish PR 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("${{ steps.changelog.outputs.current_version }}-pr.")).name' | sed 's/.*versions\///g' > pr_versions.txt + # while read -r version; do + # echo "Unpublishing PR version: $version" + # gcloud artifacts versions delete --delete-tags --quiet --repository=npm --location=europe-west3 --project=hoprassociation --package ${{ vars.NPM_PACKAGE_NAME }} $version + # done < pr_versions.txt + + # - name: Publish to Google Artifact Registry + # run: yarn publish --tag latest + # env: + # NODE_AUTH_TOKEN: ${{ steps.setup.outputs.access_token }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + cache-dependency-path: ./yarn.lock + registry-url: https://registry.npmjs.org - name: Publish to npm - run: yarn publish --no-git-tag-version --registry https://registry.npmjs.org --tag latest + run: yarn publish --no-git-tag-version --tag latest env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}