|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*.*.*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + name: Release / Node ${{ matrix.node }} |
| 11 | + |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + node: ['14'] |
| 15 | + |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + |
| 21 | + - uses: actions/cache@v1 |
| 22 | + with: |
| 23 | + path: ~/.npm |
| 24 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 25 | + restore-keys: | |
| 26 | + ${{ runner.os }}-node- |
| 27 | +
|
| 28 | + - name: Set up Node |
| 29 | + uses: actions/setup-node@v1 |
| 30 | + with: |
| 31 | + node-version: ${{ matrix.node }} |
| 32 | + |
| 33 | + - name: Prepare release |
| 34 | + run: | |
| 35 | + npm install |
| 36 | + npm run dist |
| 37 | + tar -czvf pg-api-linux.tar.gz -C ./bin start-linux |
| 38 | + tar -czvf pg-api-macos.tar.gz -C ./bin start-macos |
| 39 | + tar -czvf pg-api-windows.tar.gz -C ./bin start-win.exe |
| 40 | +
|
| 41 | + - name: Create release |
| 42 | + id: create_release |
| 43 | + uses: actions/create-release@v1 |
| 44 | + env: |
| 45 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + with: |
| 47 | + tag_name: ${{ github.ref }} |
| 48 | + release_name: ${{ github.ref }} |
| 49 | + |
| 50 | + - name: Upload linux release asset |
| 51 | + uses: actions/upload-release-asset@v1 |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + with: |
| 55 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 56 | + asset_path: ./pg-api-linux.tar.gz |
| 57 | + asset_name: pg-api-linux.tar.gz |
| 58 | + asset_content_type: application/gzip |
| 59 | + |
| 60 | + - name: Upload macos release asset |
| 61 | + uses: actions/upload-release-asset@v1 |
| 62 | + env: |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + with: |
| 65 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 66 | + asset_path: ./pg-api-macos.tar.gz |
| 67 | + asset_name: pg-api-macos.tar.gz |
| 68 | + asset_content_type: application/gzip |
| 69 | + |
| 70 | + - name: Upload windows release asset |
| 71 | + uses: actions/upload-release-asset@v1 |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + with: |
| 75 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 76 | + asset_path: ./pg-api-windows.tar.gz |
| 77 | + asset_name: pg-api-windows.tar.gz |
| 78 | + asset_content_type: application/gzip |
| 79 | + |
| 80 | + - name: Fly.io deploy |
| 81 | + uses: superfly/flyctl-actions@1.0 |
| 82 | + env: |
| 83 | + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
| 84 | + with: |
| 85 | + args: 'deploy' |
0 commit comments