Merge pull request #157 from interlay/dependabot/github_actions/actio… #179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build docker image | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'testnet' | |
tags: | |
- '*' | |
jobs: | |
build_docker: | |
runs-on: [self-hosted, linux] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare | |
id: prep | |
run: | | |
TAG=$(echo $GITHUB_SHA | head -c7) | |
TS=$(date +%s) | |
echo ::set-output name=branch_name::$(echo ${GITHUB_REF##*/}) | |
echo ::set-output name=tag::${TAG} | |
echo ::set-output name=ts::${TS} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup docker context for buildx | |
id: buildx-context | |
run: | | |
docker context create builders | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
endpoint: builders | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Login to Dockerhub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: docker.io/interlayhq/interbtc-hydra-processor | |
tags: | | |
type=sha,prefix=${{ steps.prep.outputs.branch_name }}-,suffix=-${{ steps.prep.outputs.ts }} | |
type=ref,event=branch | |
type=ref,event=tag | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64 #,linux/arm64 |