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