|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Version to pass to release.sh [vX.X.X]' |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + version: |
| 12 | + runs-on: ubuntu-20.04 |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v2 |
| 16 | + with: |
| 17 | + # pull all the branches and tags |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - uses: actions/setup-node@v2 |
| 21 | + with: |
| 22 | + node-version: 14 |
| 23 | + registry-url: https://registry.npmjs.org/ |
| 24 | + |
| 25 | + - name: Set up Go |
| 26 | + uses: actions/setup-go@v2 |
| 27 | + with: |
| 28 | + go-version: 1.16 |
| 29 | + |
| 30 | + - name: Install git-chglog |
| 31 | + run: | |
| 32 | + curl https://i.jpillora.com/git-chglog/git-chglog! | sudo bash |
| 33 | +
|
| 34 | + - name: Cache node modules |
| 35 | + uses: actions/cache@v2 |
| 36 | + env: |
| 37 | + cache-name: cache-node-modules |
| 38 | + with: |
| 39 | + # npm cache files are stored in `~/.npm` on Linux/macOS |
| 40 | + path: ~/.npm |
| 41 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 44 | + ${{ runner.os }}-build- |
| 45 | + ${{ runner.os }}- |
| 46 | +
|
| 47 | + - name: Install Dependencies |
| 48 | + run: npm install |
| 49 | + |
| 50 | + - name: Setup git user |
| 51 | + run: | |
| 52 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 53 | + git config --local user.name "github-actions[bot]" |
| 54 | +
|
| 55 | + - name: npm version |
| 56 | + run: | |
| 57 | + npm version ${{ github.event.inputs.version }} |
| 58 | +
|
| 59 | + - name: Push changes |
| 60 | + |
| 61 | + with: |
| 62 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + tags: true |
| 64 | + branch: ${{ github.ref }} |
| 65 | + |
| 66 | + - name: Create Release |
| 67 | + uses: goreleaser/goreleaser-action@v2 |
| 68 | + with: |
| 69 | + version: latest |
| 70 | + args: release --rm-dist |
| 71 | + env: |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + |
| 74 | + - name: npm publish |
| 75 | + run: npm publish --access public |
| 76 | + env: |
| 77 | + NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} |
| 78 | + NPM_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} |
| 79 | + token: ${{ secrets.ORG_NPM_TOKEN }} |
0 commit comments