-
Notifications
You must be signed in to change notification settings - Fork 7
152 lines (141 loc) · 4.74 KB
/
build.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Build and release
on:
push:
branches:
- master
- develop
- staging
pull_request:
branches:
- master
- develop
- staging
workflow_dispatch:
inputs:
release:
description: Release the new version?
required: false
default: "true"
version:
description: The version to release
required: true
jobs:
check-formatting:
name: Check Haskell formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
- name: Run fourmolu
run: |
nix-shell nix/ci.nix -j auto --run "git ls-files '*.hs' | xargs fourmolu -m inplace --ghc-opt -XRecursiveDo --ghc-opt -XTypeApplications"
git diff --exit-code
octo-macOS:
name: macOS octo CLI Release (Stack)
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Cache stack dependencies
uses: actions/cache@v2
with:
path: ~/.stack
key: octo-cli-stack-${{ runner.os }}
# TODO: Remove this step once https://github.com/actions/cache/issues/445 is resolved.
- name: Fix macOS cache bug
run: rm -rf ~/.stack/setup-exe-cache
- name: Build
run: stack build octo-cli --local-bin-path out --copy-bins
- uses: actions/upload-artifact@v2
with:
name: octo-cli-macos
path: out/octo
octo-linux:
name: Linux octo CLI Release (Nix)
runs-on: ubuntu-latest
timeout-minutes: 600
steps:
- uses: actions/checkout@v2
- name: Common setup
uses: ./.github/actions/common_setup
with:
cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Build
run: nix-build -A projectCross.musl64.hsPkgs.octo-cli.components.exes.octo --arg prod true -j auto
- uses: actions/upload-artifact@v2
with:
name: octo-cli-linux
path: result/bin/octo
docker-images:
name: Docker Images
runs-on: ubuntu-latest
timeout-minutes: 600
steps:
- uses: actions/checkout@v2
- name: Common setup
uses: ./.github/actions/common_setup
with:
cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Build Docker Images
run: nix-build ./nix -j auto
- name: Push Nightly Docker Images to DockerHub
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: ./.github/actions/push_docker_images
with:
tag: nightly
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Rename Docker image archives
run: |
cp $(nix-build ./nix -j auto -A octo-cli-container) octo-cli-image.tar.gz
cp $(nix-build ./nix -j auto -A octopod-server-container) octopod-server-image.tar.gz
- name: Upload octo CLI Image
uses: actions/upload-artifact@v2
with:
name: octo-cli-image
path: octo-cli-image.tar.gz
- name: Upload Octopod Server Image
uses: actions/upload-artifact@v2
with:
name: octopod-server-image
path: octopod-server-image.tar.gz
release:
name: Release
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true'
needs: [octo-macOS, octo-linux, docker-images]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: Common setup
uses: ./.github/actions/common_setup
with:
cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Push Docker Release Images to DockerHub
uses: ./.github/actions/push_docker_images
with:
tag: ${{ github.event.inputs.version }}
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker latest Images to DockerHub
uses: ./.github/actions/push_docker_images
with:
tag: latest
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/download-artifact@v2
- name: Zip and move
run: |
chmod +x octo-cli-macos/octo
zip octo-cli-macos octo-cli-macos/octo
chmod +x octo-cli-linux/octo
zip octo-cli-linux octo-cli-linux/octo
mv octo-cli-image/* .
mv octopod-server-image/* .
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "${{ github.event.inputs.version }}"
files: |
*.zip
*.tar.gz