| 1 |
name: 'build-gosop' |
| 2 |
description: 'Build gosop from the current branch' |
| 3 |
|
| 4 |
inputs: |
| 5 |
|
| 6 |
go-crypto-ref: |
| 7 |
description: 'go-crypto branch tag or commit to build from' |
| 8 |
required: true |
| 9 |
default: '' |
| 10 |
|
| 11 |
binary-location: |
| 12 |
description: 'Path for the gosop binary' |
| 13 |
required: true |
| 14 |
default: './gosop-${{ github.sha }}' |
| 15 |
|
| 16 |
branch-gosop: |
| 17 |
description: 'Branch of the gosop to use' |
| 18 |
required: false |
| 19 |
default: 'main' |
| 20 |
|
| 21 |
gosop-build-path: |
| 22 |
description: 'Build script of the gosop to use' |
| 23 |
required: false |
| 24 |
default: 'build_gosop_v1.sh' |
| 25 |
|
| 26 |
runs: |
| 27 |
using: "composite" |
| 28 |
steps: |
| 29 |
- name: Checkout go-crypto |
| 30 |
uses: actions/checkout@v3 |
| 31 |
with: |
| 32 |
ref: ${{ inputs.go-crypto-ref }} |
| 33 |
path: go-crypto |
| 34 |
# Build gosop |
| 35 |
- name: Set up latest golang |
| 36 |
uses: actions/setup-go@v3 |
| 37 |
with: |
| 38 |
go-version: ^1.18 |
| 39 |
- name: Check out gosop |
| 40 |
uses: actions/checkout@v3 |
| 41 |
with: |
| 42 |
repository: ProtonMail/gosop |
| 43 |
ref: ${{ inputs.branch-gosop }} |
| 44 |
path: gosop |
| 45 |
- name: Cache go modules |
| 46 |
uses: actions/cache@v3 |
| 47 |
with: |
| 48 |
path: | |
| 49 |
~/.cache/go-build |
| 50 |
~/go/pkg/mod |
| 51 |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 52 |
restore-keys: | |
| 53 |
${{ runner.os }}-go- |
| 54 |
- name: Build gosop |
| 55 |
run: ./.github/test-suite/${{ inputs.gosop-build-path }} |
| 56 |
shell: bash |
| 57 |
# Test the binary |
| 58 |
- name: Print gosop version |
| 59 |
run: ./gosop/gosop version --extended |
| 60 |
shell: bash |
| 61 |
# Move and rename binary |
| 62 |
- name: Move binary |
| 63 |
run: mv gosop/gosop ${{ inputs.binary-location }} |
| 64 |
shell: bash |
| 65 |
|
| 66 |
|