forked from ecadlabs/taquito
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 2.68 KB
/
deploy_edge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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@v2
- uses: actions/setup-node@v2
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 "actions@github.com" && 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 }}