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