@@ -48,15 +48,10 @@ jobs:
4848 timeout-minutes: 600
4949 steps:
5050 - uses: actions/checkout@v2
51− - uses: cachix/install-nix-action@v12
52− with:
53− extra_nix_config: |
54− trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
55− substituters = https://hydra.iohk.io https://cache.nixos.org/
56− - uses: cachix/cachix-action@v8
51+ - name: Common setup
52+ uses: ./.github/actions/common_setup
5753 with:
58− name: octopod
59− signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
54+ cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
6055 - name: Build
6156 run: nix-build -A projectCross.musl64.hsPkgs.octo-cli.components.exes.octo --arg prod true -j auto
6257 - uses: actions/upload-artifact@v2
@@ -68,77 +63,27 @@ jobs:
6863 runs-on: ubuntu-latest
6964 timeout-minutes: 600
7065 steps:
71− - name: Increase swap
72− run: |
73− free -h
74−
75− sudo swapoff /mnt/swapfile
76− sudo fallocate -l 12G /mnt/swapfile
77− sudo mkswap /mnt/swapfile
78− sudo swapon /mnt/swapfile
79−
80− free -h - uses: actions/checkout@v2
81−
8266 - uses: actions/checkout@v2
8367
84− - name: Install Nix
85− uses: cachix/install-nix-action@v12
68+ - name: Common setup
69+ uses: ./.github/actions/common_setup
8670 with:
87− extra_nix_config: |
88− trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
89− substituters = https://hydra.iohk.io https://cache.nixos.org/
90−
91− - name: Login to Cachix
92− uses: cachix/cachix-action@v8
93− with:
94− name: octopod
95− signingKey: ${{ secrets.CACHIX_SIGNING_KEY }}
71+ cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
9672
9773 - name: Build Docker Images
98− run: |
99− # enable required features (see https://github.com/cachix/install-nix-action/issues/19)
100− mkdir -p ~/.config/nix
101− echo "system-features = kvm" >> ~/.config/nix/nix.conf
102−
103− # build docker images
104− ./build.sh build
105−
106− - name: Login to DockerHub
107− id: login-docker-hub
108− if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/develop'
109− uses: docker/login-action@v1
110− with:
111− username: ${{ secrets.DOCKERHUB_USERNAME }}
112− password: ${{ secrets.DOCKERHUB_TOKEN }}
113−
114− - name: Push Docker Images to DockerHub
115− if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging'
116− run: |
117− # push docker images to DockerHub
118− image_name=`cat octo-docker | docker load | awk '{print $3}'`
119− docker tag $image_name typeable/octo:latest
120− docker push typeable/octo:latest
121−
122− image_name=`cat octopod-server-docker | docker load | awk '{print $3}'`
123− docker tag $image_name typeable/octopod:latest
124− docker push typeable/octopod:latest
74+ run: nix-build ./nix -j auto
12575
12676 - name: Push Nightly Docker Images to DockerHub
127− if: github.ref == 'refs/heads/develop'
128− run: |
129− # push docker images to DockerHub
130− image_name=`cat octo-docker | docker load | awk '{print $3}'`
131− docker tag $image_name typeable/octo:nightly
132− docker push typeable/octo:nightly
133−
134− image_name=`cat octopod-server-docker | docker load | awk '{print $3}'`
135− docker tag $image_name typeable/octopod:nightly
136− docker push typeable/octopod:nightly
77+ uses: ./.github/actions/push_docker_images
78+ with:
79+ tag: nightly
80+ docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
81+ docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
13782
13883 - name: Rename Docker image archives
13984 run: |
140− mv octo-docker octo-cli-image.tar.gz
141− mv octopod-server-docker octopod-server-image.tar.gz
85+ cp $(nix-build ./nix -j auto -A octopod-server-container) octo-cli-image.tar.gz
86+ cp $(nix-build ./nix -j auto -A octo-cli-container) octopod-server-image.tar.gz
14287
14388 - name: Upload octo CLI Image
14489 uses: actions/upload-artifact@v2
@@ -151,32 +96,3 @@ jobs:
15196 with:
15297 name: octopod-server-image
15398 path: octopod-server-image.tar.gz
154−
155− - name: Clean up
156− if: always()
157− continue-on-error: true
158− run: |
159− docker logout ${{ steps.login-docker-hub.outputs.registry }}
160−
161− release:
162− name: "Release"
163− if: github.ref == 'refs/heads/master'
164− runs-on: "ubuntu-latest"
165− needs: [octo-macOS, octo-linux, docker-images]
166− steps:
167− - uses: actions/download-artifact@v2
168− - name: Zip
169− run: |
170− chmod +x octo-cli-macos/octo
171− zip octo-cli-macos octo-cli-macos/octo
172− chmod +x octo-cli-linux/octo
173− zip octo-cli-linux octo-cli-linux/octo
174− - uses: "marvinpinto/action-automatic-releases@latest"
175− with:
176− repo_token: "${{ secrets.GITHUB_TOKEN }}"
177− automatic_release_tag: "latest"
178− prerelease: true
179− title: "Pre-Release"
180− files: |
181− *.zip
182− *.tar.gz