Skip to content

Commit

Permalink
Fixing release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ausias-armesto committed Aug 8, 2024
1 parent 95555b8 commit 60cc1c1
Showing 1 changed file with 36 additions and 26 deletions.
62 changes: 36 additions & 26 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}

Expand Down

0 comments on commit 60cc1c1

Please sign in to comment.