fix: make metadatahash optional (#335) #175
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: 02-JS-Publish | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
check_tag: | |
runs-on: ubuntu-latest | |
outputs: | |
package: ${{ steps.tag-info.outputs.package }} | |
version: ${{ steps.tag-info.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get package and version from Github Tag | |
id: tag-info | |
run: | | |
GITHUB_REF="${{ github.ref }}" | |
TAG=${GITHUB_REF##*/} | |
VERSION=$(echo "$TAG" | grep -woP "([0-9]+\.[0-9]+\.[0-9]+)-\w+" | sed 's/-javascript//') | |
PACKAGE=$(echo "$TAG" | grep -oP "javascript-(.+)" | sed 's/javascript-//') | |
if [ -d "./modules/$PACKAGE" ]; then | |
echo "package=$PACKAGE" >> $GITHUB_OUTPUT | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
fi | |
test: | |
uses: ./.github/workflows/javascript_test.yml | |
secrets: | |
IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }} | |
with: | |
run: true | |
publish: | |
runs-on: ubuntu-latest | |
needs: [check_tag, test] | |
if: ${{ needs.check_tag.outputs.package }} | |
steps: | |
- name: Validate values (package and version) from Github Tag | |
run: | | |
if [ -z "${{ needs.check_tag.outputs.package }}" ]; then | |
echo "::error ::No package found in tag" | |
exit 1 | |
fi | |
if [ -z "${{ needs.check_tag.outputs.version }}" ]; then | |
echo "::error ::No version found in tag" | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: 'develop' | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
cache: 'yarn' | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org | |
- name: Install deps | |
run: yarn install --frozen-lockfile | |
- name: Build subpackages | |
run: yarn run build | |
- name: Publish NPM pkg (${{ needs.check_tag.outputs.package }} - ${{ needs.check_tag.outputs.version }}) | |
run: yarn publish --no-git-tag-version --new-version ${{ needs.check_tag.outputs.version }} | |
working-directory: ./modules/${{ needs.check_tag.outputs.package }} | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
- name: Setup Python environment | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Generate release-notes.txt | |
id: notes | |
run: python ./.github/scripts/generate_release_notes.py "./modules/${{ needs.check_tag.outputs.package }}/CHANGELOG.md" | |
- name: Add NPM pkg info to release-notes.txt | |
run: | | |
echo "### NPM Packages" >> release-notes.txt | |
echo "- [@aragon/sdk-${{ needs.check_tag.outputs.package }} version ${{ needs.check_tag.outputs.version }}](https://www.npmjs.com/package/@aragon/sdk-${{ needs.check_tag.outputs.package }})" >> release-notes.txt | |
echo " " >> release-notes.txt | |
- name: Create a Github Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
prerelease: false | |
body_path: release-notes.txt |