summaryrefslogtreecommitdiffstats
path: root/.github/workflows/post-deploy.yml
blob: 9f7ff103853c3fe831592c81d574a56483fd91e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Update Packages

on:
  release:
    types: [published]

# TODO: Move the homebrew and choco steps back to the main deployment script.

jobs:
  post-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set env
        run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

      - name: Test env
        run: |
          echo $RELEASE_VERSION

      - name: Make sure you're not on master...
        run: |
          if [[ $RELEASE_VERSION == "master" ]]; then
            exit 1
          fi

      - name: Download packages
        run: |
          curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-unknown-linux-gnu.tar.gz";
          curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-apple-darwin.tar.gz";
          curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_i686-pc-windows-msvc.zip";
          curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-pc-windows-msvc.zip";

      - name: Execute choco packaging script
        run: |
          python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $RELEASE_VERSION "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/"
          cd ./deployment/windows/choco
          zip -r choco.zip "bottom.nuspec" "tools"
          cd ../../../
          cp ./deployment/windows/choco/choco.zip .

      - name: Upload choco.zip to release
        uses: svenstaro/upload-release-action@2.1.0
        with:
          repo_token: ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }}
          file: choco.zip
          tag: ${{ env.RELEASE_VERSION }}
          overwrite: true

      - name: Execute Homebrew packaging script
        run: |
          python "./deployment/packager.py" $RELEASE_VERSION "./deployment/macos/homebrew/bottom.rb.template" "./bottom.rb" "SHA256" "./bottom_x86_64-apple-darwin.tar.gz" "./bottom_x86_64-unknown-linux-gnu.tar.gz";

      - name: Upload bottom.rb to release
        uses: svenstaro/upload-release-action@2.1.0
        with:
          repo_token: ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }}
          file: bottom.rb
          tag: ${{ env.RELEASE_VERSION }}
          overwrite: true

      - name: Trigger homebrew
        run: |
          curl -X POST https://api.github.com/repos/ClementTsang/homebrew-bottom/dispatches \
          -H 'Accept: application/vnd.github.everest-preview+json' \
          -u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \
          --data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }'

      - name: Trigger choco
        run: |
          curl -X POST https://api.github.com/repos/ClementTsang/choco-bottom/dispatches \
          -H 'Accept: application/vnd.github.everest-preview+json' \
          -u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \
          --data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }'