|
| 1 | +name: Build and Deploy |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + name: Build uselocalstorage react frontend |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Discord notification - start build |
| 13 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 14 | + with: |
| 15 | + severity: info |
| 16 | + text: ${{github.repository}} - ${{github.workflow}} |
| 17 | + details: "- **Pipeline:** https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" |
| 18 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 19 | + |
| 20 | + - name: Checkout Repo |
| 21 | + uses: actions/checkout@master |
| 22 | + |
| 23 | + - name: Install Dependencies |
| 24 | + run: npm run i-all |
| 25 | + |
| 26 | + - name: Check lint |
| 27 | + run: yarn lint |
| 28 | + |
| 29 | + # - name: Check tests |
| 30 | + # run: yarn test |
| 31 | + |
| 32 | + - name: Build |
| 33 | + run: npm run build:all |
| 34 | + |
| 35 | + - name: "Automated Version Bump" |
| 36 | + uses: "phips28/gh-action-bump-version@master" |
| 37 | + env: |
| 38 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + with: |
| 40 | + skip-tag: "true" |
| 41 | + |
| 42 | + - name: Generate dist artifact for package |
| 43 | + uses: actions/upload-artifact@v2 |
| 44 | + with: |
| 45 | + name: dist-folder |
| 46 | + path: dist/**/* |
| 47 | + |
| 48 | + - name: Archive playground Artifact |
| 49 | + uses: actions/upload-artifact@master |
| 50 | + with: |
| 51 | + name: playground-artifact |
| 52 | + path: | |
| 53 | + ./playground/build |
| 54 | + ./playground/firebase.json |
| 55 | + ./playground/.firebaserc |
| 56 | + if-no-files-found: error |
| 57 | + |
| 58 | + - name: Discord notification - finished build (Success) |
| 59 | + if: success() |
| 60 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 61 | + with: |
| 62 | + severity: success |
| 63 | + description: Finished the build pipeline, starting deploys |
| 64 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 65 | + |
| 66 | + - name: Discord notification - finished build (error) |
| 67 | + if: failure() |
| 68 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 69 | + with: |
| 70 | + severity: error |
| 71 | + description: Build uselocalstorage react frontend failed |
| 72 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 73 | + |
| 74 | + - name: Discord notification - finished build (cancelled) |
| 75 | + if: cancelled() |
| 76 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 77 | + with: |
| 78 | + severity: warn |
| 79 | + description: Build uselocalstorage react frontend cancelled |
| 80 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 81 | + |
| 82 | + publish: |
| 83 | + name: Generates new release and publish |
| 84 | + needs: [build] |
| 85 | + runs-on: ubuntu-latest |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 89 | + steps: |
| 90 | + - name: Checkout Repo |
| 91 | + uses: actions/checkout@master |
| 92 | + |
| 93 | + - uses: actions/download-artifact@v2 |
| 94 | + with: |
| 95 | + name: dist-folder |
| 96 | + path: dist |
| 97 | + |
| 98 | + - name: Publish on NPM |
| 99 | + uses: mikeal/merge-release@master |
| 100 | + env: |
| 101 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 102 | + NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 103 | + |
| 104 | + - name: release on Github |
| 105 | + uses: rymndhng/release-on-push-action@master |
| 106 | + with: |
| 107 | + bump_version_scheme: patch |
| 108 | + |
| 109 | + - name: Notify discord |
| 110 | + if: success() |
| 111 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 112 | + with: |
| 113 | + severity: success |
| 114 | + description: Deploy finished - new release deployed |
| 115 | + details: | |
| 116 | + **- Tag name:** ${{ steps.release.outputs.tag_name }} |
| 117 | + **- Release version:** ${{ steps.release.outputs.version }} |
| 118 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 119 | + |
| 120 | + - name: Discord notification - Github generated release (error) |
| 121 | + if: failure() |
| 122 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 123 | + with: |
| 124 | + severity: error |
| 125 | + description: Github generated release failed |
| 126 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 127 | + |
| 128 | + - name: Discord notification - Github generated release (cancelled) |
| 129 | + if: cancelled() |
| 130 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 131 | + with: |
| 132 | + severity: warn |
| 133 | + description: Github generated release cancelled |
| 134 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 135 | + |
| 136 | + deploy-firebase: |
| 137 | + name: Deploy on Firebase |
| 138 | + needs: [publish] |
| 139 | + runs-on: ubuntu-latest |
| 140 | + steps: |
| 141 | + - name: Download Playground Artifact |
| 142 | + uses: actions/download-artifact@master |
| 143 | + with: |
| 144 | + name: playground-artifact |
| 145 | + |
| 146 | + - name: Deploy to Firebase |
| 147 | + uses: w9jds/firebase-action@master |
| 148 | + with: |
| 149 | + args: deploy |
| 150 | + env: |
| 151 | + FIREBASE_TOKEN: ${{ secrets.USELOCALSTORAGE_FIREBASE_TOKEN }} |
| 152 | + |
| 153 | + - name: Discord notification - deploy (success) |
| 154 | + if: success() |
| 155 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 156 | + with: |
| 157 | + severity: info |
| 158 | + description: Deploy finished - uselocalstorage |
| 159 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 160 | + |
| 161 | + - name: Discord notification - deploy (error) |
| 162 | + if: failure() |
| 163 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 164 | + with: |
| 165 | + severity: error |
| 166 | + description: Deploy failed |
| 167 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
| 168 | + |
| 169 | + - name: Discord notification - deploy (cancelled) |
| 170 | + if: cancelled() |
| 171 | + uses: rjstone/discord-webhook-notify@v1.0.4 |
| 172 | + with: |
| 173 | + severity: warn |
| 174 | + description: Deploy cancelled |
| 175 | + webhookUrl: ${{ secrets.DISCORD_CHANNEL_WEBHOOK }} |
0 commit comments