|
| 1 | +name: main |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + build: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + steps: |
| 8 | + - uses: actions/checkout@v2 |
| 9 | + with: |
| 10 | + fetch-depth: 0 # Need all tags to get a version number in-between tags |
| 11 | + - uses: actions/setup-node@v2-beta |
| 12 | + - run: yarn --frozen-lockfile |
| 13 | + - run: yarn build-demo |
| 14 | + - uses: actions/upload-artifact@v2 |
| 15 | + with: |
| 16 | + name: dist |
| 17 | + path: dist/ |
| 18 | + |
| 19 | + test: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - uses: actions/setup-node@v2-beta |
| 24 | + - run: yarn --frozen-lockfile |
| 25 | + - run: ./node_modules/.bin/ng test fab-speed-dial --progress false --watch=false --browsers ChromeHeadlessCustom |
| 26 | + - run: ./node_modules/.bin/ng test demo --progress false --watch=false --browsers ChromeHeadlessCustom |
| 27 | + |
| 28 | + lint: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + - uses: actions/setup-node@v2-beta |
| 33 | + - run: yarn --frozen-lockfile |
| 34 | + - run: yarn lint |
| 35 | + |
| 36 | + prettier: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + - uses: actions/setup-node@v2-beta |
| 41 | + - run: yarn --frozen-lockfile |
| 42 | + - run: ./node_modules/.bin/prettier --check . |
| 43 | + |
| 44 | + publish-demo: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + needs: |
| 47 | + - build |
| 48 | + - test |
| 49 | + steps: |
| 50 | + - uses: actions/download-artifact@v2 |
| 51 | + with: |
| 52 | + name: dist |
| 53 | + path: dist/ |
| 54 | + - uses: crazy-max/ghaction-github-pages@v2 |
| 55 | + with: |
| 56 | + build_dir: dist/demo |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + |
| 60 | + release: |
| 61 | + runs-on: ubuntu-latest |
| 62 | + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
| 63 | + needs: |
| 64 | + - build |
| 65 | + - test |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v2 |
| 68 | + with: |
| 69 | + ref: ${{ github.ref }} # Otherwise our annotated tag is not fetched and we cannot get correct version |
| 70 | + - uses: actions/download-artifact@v2 |
| 71 | + with: |
| 72 | + name: dist |
| 73 | + path: dist/ |
| 74 | + - run: rm .gitignore |
| 75 | + |
| 76 | + # Publish to npm |
| 77 | + - uses: actions/setup-node@v2-beta |
| 78 | + with: |
| 79 | + registry-url: 'https://registry.npmjs.org' |
| 80 | + - run: npm publish --access public dist/fab-speed-dial |
| 81 | + env: |
| 82 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 83 | + |
| 84 | + # Publish to GitHub Packages |
| 85 | + - uses: actions/setup-node@v2-beta |
| 86 | + with: |
| 87 | + registry-url: 'https://npm.pkg.github.com' |
| 88 | + - run: npm publish --access public dist/fab-speed-dial |
| 89 | + env: |
| 90 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + |
| 92 | + # Create release |
| 93 | + - name: Get release info |
| 94 | + id: release-info |
| 95 | + run: | |
| 96 | + echo "::set-output name=subject::$(git tag --format '%(contents:subject)' --points-at)" |
| 97 | + git tag --format '%(contents:body)' --points-at > release-body.txt |
| 98 | + - uses: actions/create-release@v1 |
| 99 | + env: |
| 100 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 101 | + with: |
| 102 | + tag_name: ${{ github.ref }} |
| 103 | + release_name: ${{ steps.release-info.outputs.subject }} |
| 104 | + body_path: release-body.txt |
0 commit comments