-
Notifications
You must be signed in to change notification settings - Fork 9
79 lines (72 loc) · 2.89 KB
/
docker.yml
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
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
name: docker
# NOTE: The purpose of this workflow is only to test if Docker images build
# successfully.
# Oasis recommends using binaries from the official GitHub releases as described
# in repo's docker/README.md.
# Trigger the workflow when:
on:
# A push occurs to one of the matched branches.
push:
# XXX: ideally on master branches we would build the image only if there are changes in the
# 'docker/' directory (as we do in pull_requests). However, this doesn't work when pushing a new
# 'stable/*' branch - the build on a new branch does not trigger unless there are changes
# compared to master on the filtered path.
# If this is ever fixed, or per branch filters are possible, bring back the path filter to only
# build the image when there are changes within 'docker/' directory.
branches:
- master
- stable/*
# Or when a pull request event occurs for a pull request against one of the matched branches and at least
# one modified file matches the configured paths.
#
# NOTE: We use this to be able to easily test Docker image changes.
pull_request:
branches:
- master
- stable/*
paths:
- docker/**
# Or every day at 04:00 UTC (for the default/master branch).
schedule:
- cron: "0 4 * * *"
jobs:
build-images:
# NOTE: This name appears in GitHub's Checks API.
name: build-images
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Determine branch and tag name
id: branch_tag
shell: bash
run: |
if [[ -z $GITHUB_BASE_REF ]]; then
# On master/stable branches.
branch=${GITHUB_REF_NAME}
tag=${GITHUB_REF_NAME}
else
# On pull request branches.
branch=${GITHUB_HEAD_REF}
tag=pr-$(git describe --always --match '' --abbrev=7)
fi
tag=${tag//\//-}
echo "::set-output name=branch::${branch}"
echo "::set-output name=tag::${tag}"
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: "Rebuild oasisprotocol/oasis-rosetta-gateway:${{ steps.branch_tag.outputs.tag }}"
uses: docker/[email protected]
with:
context: docker
file: docker/Dockerfile
build-args: |
GATEWAY_BRANCH=${{ steps.branch_tag.outputs.branch }}
tags: oasisprotocol/oasis-rosetta-gateway:${{ steps.branch_tag.outputs.tag }}
pull: true
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.branch_tag.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}