forked from build-trust/ockam
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (115 loc) · 4.25 KB
/
ockam-package.yml
File metadata and controls
142 lines (115 loc) · 4.25 KB
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
name: Ockam Container Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Ockam tag to build'
required: true
binaries_sha:
description: 'Ockam Release Assets SHA'
required: false
is_release:
description: 'Indicate If Workflow Is To Release Ockam Package Or Be A Draft'
type: choice
default: false
options:
- false
- true
permissions: write-all
# contents: read
env:
DEPLOYMENT_NAME: ockam
ARTIFACT_NAME: ockam
jobs:
build-and-publish-artifact:
if: github.event.inputs.is_release == 'false'
name: "Build And Publish Ockam Container As Draft"
runs-on: ubuntu-20.04
environment: release
steps:
- name: Checker
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -ex
mkdir assets && cd assets
gh release download ${{ github.event.inputs.tag }} -R build-trust/ockam
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
path: ockam
- id: image
shell: bash
run: |
tag_name="${{ github.event.inputs.tag }}"
version=${tag_name:7}
echo ::set-output name=image::"ghcr.io/build-trust/$ARTIFACT_NAME:${version}-draft"
- name: Update Docker Template
shell: bash
run: |
set -x
temp_dir=$(mktemp -d)
cp ./ockam/tools/templates/ockam.dockerfile $temp_dir/Dockerfile
cd $temp_dir
binaries=(${{ github.event.inputs.binaries_sha }})
for binary in ${binaries[@]}; do
echo "$binary"
file=(${binary//:/ })
echo "${file[@]}"
if [[ ${file[0]} == *".so"* || ${file[0]} == *".sig"* ]]; then
echo "elixir nif library found, skipping."
continue
fi
sed -i "s/${file[0]}_sha256_value/${file[1]}/g" Dockerfile
done
cat Dockerfile
cp Dockerfile $GITHUB_WORKSPACE/ockam/tools/templates
- uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ghcr.io
username: build-trust
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8
- id: buildx
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6
- name: Build And Publish As Draft
run: |
tag_name="${{ github.event.inputs.tag }}"
version=${tag_name:7}
docker buildx build --push \
--tag ghcr.io/build-trust/ockam:${version}-draft \
--file ./ockam/tools/templates/Dockerfile \
--platform linux/amd64,linux/arm64/v8,linux/arm/v7 .
make-latest:
if: github.event.inputs.is_release == 'true'
name: "Make Draft Release Latest"
runs-on: ubuntu-20.04
environment: release
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ghcr.io
username: build-trust
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Version
id: image
run: |
tag_name="${{ github.event.inputs.tag }}"
version=${tag_name:7}
echo ::set-output name=version::"${version}"
- name: Deploy Latest Image
shell: bash
run: |
set -o xtrace
docker pull ghcr.io/build-trust/ockam:${{ steps.image.outputs.version }}-draft
manifest=$(docker manifest inspect -v ghcr.io/build-trust/ockam:${{ steps.image.outputs.version }}-draft)
refs=$(echo $manifest | jq -r .[].Descriptor.digest)
amended_refs=""
for ref in ${refs[@]}; do
amended_refs=" ${amended_refs[@]} --amend ghcr.io/build-trust/ockam@$ref"
done
docker manifest create ghcr.io/build-trust/ockam:${{ steps.image.outputs.version }} $amended_refs
docker manifest push ghcr.io/build-trust/ockam:${{ steps.image.outputs.version }}
docker manifest create ghcr.io/build-trust/ockam:latest $amended_refs
docker manifest push ghcr.io/build-trust/ockam:latest