@@ -5,6 +5,15 @@ on:
5 branches: [master]
5 branches: [master]
6 pull_request:
6 pull_request:
7 branches: [master]
7 branches: [master]
11+ description: Release the new version?
15+ description: The version to release
10 build-github-action-image:
19 build-github-action-image:
@@ -14,43 +23,88 @@ jobs:
14 - uses: actions/checkout@v2
23 - uses: actions/checkout@v2
16 submodules: recursive
25 submodules: recursive
17− - name: Increase swap
26+
28+ uses: ./.github/actions/common_setup
30+ cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
32+ - name: Build Github Action Docker Image
19− free -h
34+ cp $(nix-build -A compaRESTGithubAction -j auto) compaREST-Github-Action-image.tar.gz
35+ cp $(nix-build -A compaREST -j auto) compaREST-image.tar.gz
21− sudo swapoff /mnt/swapfile
37+ - name: Build Linux static binary
22− sudo fallocate -l 12G /mnt/swapfile
38+ run: |
23− sudo mkswap /mnt/swapfile
39+ mkdir compaREST-binary
24− sudo swapon /mnt/swapfile
40+ cp (nix-build -A compaRESTBin -j auto) -o compaREST-binary/compaREST
26− free -h
42+ - name: Upload compaREST Github Action Image
43+ uses: actions/upload-artifact@v2
45+ name: compaREST-Github-Action-image
46+ path: compaREST-Github-Action-image.tar.gz
28− - name: Install Nix
48+ - name: Upload compaREST Image
29− uses: cachix/install-nix-action@v12
49+ uses: actions/upload-artifact@v2
31− extra_nix_config: |
51+ name: compaREST-image
32− trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
52+ path: compaREST-image.tar.gz
33− substituters = https://hydra.iohk.io https://cache.nixos.org/
35− - name: Login to Cachix
54+ - name: Upload compaREST Linux Binary
36− uses: cachix/cachix-action@v8
55+ uses: actions/upload-artifact@v2
38− name: octopod
57+ name: compaREST-linux
39− signingKey: ${{ secrets.CACHIX_SIGNING_KEY }}
58+ path: compaREST-binary/compaREST
41− - name: Build Github Action Docker Image
60+ - name: Push Nightly Docker Images to DockerHub
42− run: |
61+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
43− nix-build -A compaRESTGithubAction -j auto -o image
62+ uses: ./.github/actions/push_docker_images
65+ docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
66+ docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
45− - name: Log into Docker Hub
68+ release:
46− if: github.ref == 'refs/heads/master'
69+ name: Release
47− uses: docker/login-action@v1
70+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true'
71+ needs: [build-github-action-image]
72+ runs-on: "ubuntu-latest"
74+ - uses: actions/checkout@v2
76+ uses: ./.github/actions/common_setup
78+ cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
80+ - name: Push Docker Release Images to DockerHub
81+ uses: ./.github/actions/push_docker_images
49− username: ${{ secrets.DOCKER_HUB_USERNAME }}
83+ tag: ${{ github.event.inputs.version }}
50− password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
84+ docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
85+ docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
52− - name: Upload Image to Docker Hub
87+ - name: Push Docker latest Images to DockerHub
53− if: github.ref == 'refs/heads/master'
88+ uses: ./.github/actions/push_docker_images
91+ docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
92+ docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
94+ - uses: actions/download-artifact@v2
55− docker load -i image
97+ chmod +x compaREST-linux/compaREST
56− docker push typeable/comparest-github-action:latest
98+ zip compaREST-linux compaREST-linux/compaREST
100+ mv compaREST-Github-Action-image/* .
101+ mv compaREST-image/* .
102+ - uses: "marvinpinto/action-automatic-releases@latest"
104+ repo_token: "${{ secrets.GITHUB_TOKEN }}"
105+ automatic_release_tag: "latest"
107+ title: "${{ github.event.inputs.version }}"