Skip to content

Betanet

Betanet #5874

Workflow file for this run

name: Deploy Edge
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
deploy-edge-package:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork && (github.event_name == 'pull_request' || github.ref == 'refs/heads/master') }}
env:
VERDACCIO_TOKEN: ${{ secrets.EDGE_VERDACCIO_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/hydrogen
- run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- run: echo "PACKAGE_VERSION=`node -p "require('./packages/taquito/package.json').version"`" >> $GITHUB_ENV
- run: echo "BRANCH_NAME=$(git branch --show-current)" >> $GITHUB_ENV
- run: echo "TARGET_VERSION=${PACKAGE_VERSION}-${SHORT_SHA}--${BRANCH_NAME}" >> $GITHUB_ENV
- run: npm ci
- run: find packages/ -mindepth 1 -maxdepth 2 -name README.md | xargs sed -i '1s/^/# WARNING This build is produced from a feature branch and could contain unreviewed changes from the public. Use with caution, do not use in production\n\n/'
- run: npx lerna version "${TARGET_VERSION}" --no-push --no-git-tag-version --yes
- run: npm run version-stamp
- run: npm run build
- run: npm run -w @taquito/taquito build:release
- run: git config user.email "[email protected]" && git config user.name "Github Actions"
- run: git add . && git commit -m "committing changes to files to make lerna happy in next step, this is expected to never be pushed to remote"
- run: echo ${VERDACCIO_TOKEN} >> ~/.npmrc
- run: npx lerna publish --dist-tag edge from-package --yes --registry https://npm.preview.tezostaquito.io/
- if: ${{ github.event_name == 'pull_request' }}
run: |
echo "COMMENT_BODY<<EOF" >> $GITHUB_ENV
echo "New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/." >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "### Published packages:" >> $GITHUB_ENV
echo "\`\`\`" >> $GITHUB_ENV
find packages/ -mindepth 1 -maxdepth 2 -name package.json | xargs -I{} node -pe "require('./{}')['name']" | sed "s/^\(.*\)$/npm i \1@${TARGET_VERSION} --registry https:\/\/npm.preview.tezostaquito.io\//" >> $GITHUB_ENV
echo "\`\`\`" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- if: ${{ github.event_name == 'pull_request' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: deploy-packages
message: ${{ env.COMMENT_BODY }}