|
| 1 | +name: publish_package |
| 2 | + |
| 3 | +# Controls when the action will run. |
| 4 | +on: |
| 5 | + # Triggers the workflow on push or pull request events but only for the main branch |
| 6 | + push: |
| 7 | + branches: [feat/permissionless-mobile] |
| 8 | + |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 13 | +jobs: |
| 14 | + # This workflow contains 1 job called "build" |
| 15 | + |
| 16 | + build: |
| 17 | + runs-on: ubuntu-20.04 |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + node-version: ["18"] |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Cancel Previous Runs |
| 24 | + |
| 25 | + with: |
| 26 | + access_token: ${{ github.token }} |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + - name: Use Node.js ${{ matrix.node-version }} |
| 29 | + uses: actions/setup-node@v2 |
| 30 | + with: |
| 31 | + node-version: ${{ matrix.node-version }} |
| 32 | + - name: Get yarn cache directory path |
| 33 | + id: yarn-cache-dir-path |
| 34 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 35 | + - uses: actions/cache@v4 |
| 36 | + id: yarn-cache |
| 37 | + with: |
| 38 | + path: | |
| 39 | + ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 40 | + ./node_modules/ |
| 41 | + key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-yarn- |
| 44 | + - name: Install Dependencies |
| 45 | + if: steps.yarn-cache.outputs.cache-hit != 'true' |
| 46 | + run: yarn |
| 47 | + - name: Build |
| 48 | + run: yarn build |
| 49 | + - name: Authenticate with private NPM package |
| 50 | + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc |
| 51 | + |
| 52 | + - name: Publish Oraidex Common |
| 53 | + id: publish-common |
| 54 | + continue-on-error: true |
| 55 | + run: yarn deploy:beta packages/oraidex-common |
| 56 | + env: |
| 57 | + CI: false |
| 58 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 59 | + |
| 60 | + - name: send result via discord |
| 61 | + uses: appleboy/discord-action@master |
| 62 | + with: |
| 63 | + webhook_id: ${{ secrets.WEBHOOK_ID }} |
| 64 | + webhook_token: ${{ secrets.WEBHOOK_TOKEN }} |
| 65 | + username: "GitBot" |
| 66 | + message: "Repo oraidex-sdk has just published. result: ${{ steps.publish.outcome }}." |
0 commit comments