-
Notifications
You must be signed in to change notification settings - Fork 102
81 lines (70 loc) · 2.53 KB
/
docker.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
name: Docker
on:
push:
branches: [ main ]
tags :
- oracle-v*
pull_request:
branches: [ main ]
env:
SOLANA_VERSION: 1.14.7 # Using 1.14.x to have sbf instead of bpf. bpf does not work anymore.
SOLANA_DOCKER_IMAGE_HASH: 9130b4a26ec00c4ba99c023da98c06abb0dba2904c990af7770928e0f7dfd2d5
DOCKER_HUB: docker.io
DOCKER_USER: ${{ secrets.DOCKER_IO_USER }}
IS_RELEASE: ${{
startsWith( github.ref, 'refs/tags/pythd-' ) ||
startsWith( github.ref, 'refs/tags/oracle-' ) }}
IS_ORACLE_RELEASE: ${{
startsWith( github.ref, 'refs/tags/oracle-' ) }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Initialize Environment
run: |
set -eux
REPO_NAME="$( basename "${GITHUB_REPOSITORY}" )"
REF_NAME="$( basename "${GITHUB_REF}" )"
echo "DOCKER_IMAGE=${REPO_NAME}:${REF_NAME}" >> "${GITHUB_ENV}"
- name: Build Docker Image
run: |
set -eux
docker build \
--file docker/Dockerfile \
--build-arg SOLANA_VERSION="${SOLANA_VERSION}" \
--build-arg SOLANA_DOCKER_IMAGE_HASH="${SOLANA_DOCKER_IMAGE_HASH}" \
--tag "${DOCKER_IMAGE}" \
.
- name: Publish Docker Image
if: env.IS_RELEASE == 'true'
run: |
function publish() {
set -eux
PUB_IMAGE="${DOCKER_HUB}/${DOCKER_USER}/${DOCKER_IMAGE}"
docker login "${DOCKER_HUB}" -u "${DOCKER_USER}" --password-stdin
docker image tag "${DOCKER_IMAGE}" "${PUB_IMAGE}"
docker image push "${PUB_IMAGE}"
}
echo "${{ secrets.DOCKER_IO_PASS }}" | publish
- name : Get binary from docker
if : env.IS_ORACLE_RELEASE == 'true'
run : |
docker create -ti --name container "${DOCKER_IMAGE}" bash
docker cp container:/home/pyth/pyth-client/target/pyth/pythnet/pyth_oracle_pythnet.so .
docker rm -f container
- name : Publish Pythnet binary
if : env.IS_ORACLE_RELEASE == 'true'
uses: svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./pyth_oracle_pythnet.so
asset_name: pyth_oracle_pythnet.so
tag: ${{ github.ref }}
pinning:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v2
- run: chmod 755 ./scripts/check-docker-pin.sh
- run: ./scripts/check-docker-pin.sh