Skip to content

Commit

Permalink
Merge pull request #273 from oasisprotocol/tjanez/generalize-docker-w…
Browse files Browse the repository at this point in the history
…orkflow

github: For PRs, build docker image with the PR's branch of Rosetta
  • Loading branch information
tjanez committed Feb 3, 2022
2 parents 336eb7a + 96a283a commit e1535d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions .changelog/273.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: For PRs, build docker image with the PR's branch of Rosetta Gateway
1 change: 1 addition & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
# NOTE: The version must be specified without the patch version.
version: v1.39
skip-go-installation: true
args: --timeout 2m
# Always run this step so that all linting errors can be seen at once.
if: always()
- name: Ensure a clean code checkout
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,37 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Determine tag name
id: determine_tag
- 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#refs/heads/}
branch=${GITHUB_REF_NAME}
tag=${GITHUB_REF_NAME}
else
# On pull request branches.
branch=pr-$(git describe --always --match '' --abbrev=7)
branch=${GITHUB_HEAD_REF}
tag=pr-$(git describe --always --match '' --abbrev=7)
fi
branch=${branch//\//-}
echo "::set-output name=tag::${branch}"
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@v1

- name: "Rebuild oasisprotocol/oasis-core-rosetta-gateway:${{ steps.determine_tag.outputs.tag }}"
- name: "Rebuild oasisprotocol/oasis-core-rosetta-gateway:${{ steps.branch_tag.outputs.tag }}"
uses: docker/build-push-action@v2.6.1
with:
context: docker
file: docker/Dockerfile
tags: oasisprotocol/oasis-core-rosetta-gateway:${{ steps.determine_tag.outputs.tag }}
build-args: |
GATEWAY_BRANCH=${{ steps.branch_tag.outputs.branch }}
tags: oasisprotocol/oasis-core-rosetta-gateway:${{ steps.branch_tag.outputs.tag }}
pull: true
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.determine_tag.outputs.created }}
org.opencontainers.image.created=${{ steps.branch_tag.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}

0 comments on commit e1535d5

Please sign in to comment.