|
| 1 | +name: pipeline |
| 2 | +on: [ push ] |
| 3 | + |
| 4 | +env: |
| 5 | + TAG_NAME: $(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/_/g') |
| 6 | + NVM_NODE_VERSION: 18 |
| 7 | + PROJECT: colors |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-and-lint: |
| 15 | + runs-on: |
| 16 | + group: default-runners |
| 17 | + labels: self-hosted |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + env: |
| 21 | + CURRENT_RUNNER: ${{ runner.name }} |
| 22 | + |
| 23 | + - uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: ${{ env.NVM_NODE_VERSION }} |
| 26 | + |
| 27 | + - name: build-and-lint |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + ./bin/node-version-manager.sh yarn install --production=false --frozen-lockfile |
| 31 | + ./bin/node-version-manager.sh yarn build |
| 32 | + ./bin/node-version-manager.sh yarn lint |
| 33 | +
|
| 34 | + dry-run-publish: |
| 35 | + needs: [ build-and-lint ] |
| 36 | + runs-on: |
| 37 | + group: default-runners |
| 38 | + labels: self-hosted |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + env: |
| 42 | + CURRENT_RUNNER: ${{ runner.name }} |
| 43 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
| 44 | + |
| 45 | + - uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: ${{ env.NVM_NODE_VERSION }} |
| 48 | + |
| 49 | + - name: dry-run-publish |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + ./bin/node-version-manager.sh yarn install --production=false --frozen-lockfile |
| 53 | + ./bin/node-version-manager.sh yarn build |
| 54 | + ./bin/node-version-manager.sh npm publish --access public --tag latest --dry-run |
| 55 | +
|
| 56 | + publish-npm: |
| 57 | + needs: [ dry-run-publish ] |
| 58 | + # TODO: not working yet |
| 59 | + if: false |
| 60 | + # if: github.ref == 'refs/heads/master' |
| 61 | + runs-on: |
| 62 | + group: default-runners |
| 63 | + labels: self-hosted |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v4 |
| 66 | + env: |
| 67 | + CURRENT_RUNNER: ${{ runner.name }} |
| 68 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
| 69 | + |
| 70 | + # Setup .npmrc file to publish to npm |
| 71 | + - uses: actions/setup-node@v4 |
| 72 | + with: |
| 73 | + node-version: ${{ env.NVM_NODE_VERSION }} |
| 74 | + |
| 75 | + - name: publish-npm |
| 76 | + shell: bash |
| 77 | + run: | |
| 78 | + ./bin/node-version-manager.sh yarn install --production=false --frozen-lockfile |
| 79 | + ./bin/node-version-manager.sh yarn build |
| 80 | + ./bin/node-version-manager.sh npm publish --access public --tag latest |
0 commit comments