Skip to content

chore(deps): update docker/build-push-action action to v5 #204

chore(deps): update docker/build-push-action action to v5

chore(deps): update docker/build-push-action action to v5 #204

Workflow file for this run

---
on: # yamllint disable-line rule:truthy
push:
branches:
- 'master'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'
release:
types:
- 'created'
schedule:
# Every Tuesday at 03:10
- cron: '10 5 * * 2'
name: 🔍 Continuous integration
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os_name: ['alpine']
steps:
- name: 📦 Install goss
uses: e1himself/[email protected]
- name: 📦 Check out the codebase
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0
- name: 🌎 Set environment variables
env:
IMAGE_NAMESPACE: wayofdev/build-deps
TEMPLATE: ${{ matrix.os_name }}
run: |
export RELEASE_VERSION="${GITHUB_REF#refs/*/}" \
&& { \
echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}"; \
echo "TEMPLATE=${TEMPLATE}"; \
echo "VERSION=${RELEASE_VERSION:1}"; \
} >> "$GITHUB_ENV"
- name: 🤖 Generate dist files
run: make generate
- name: 🐳 Define docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAMESPACE }}
tags: |
type=raw,event=branch,value=latest
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
flavor: |
latest=false
prefix=${{ matrix.os_name }}-
- name: 🔑 Login to docker-hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
### For Cross Platform OSX builds uncomment these lines
- name: 🖥️ Set up QEMU
uses: docker/[email protected]
with:
platforms: arm64
- name: 🚀 Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with:
install: true
- name: 🏷️ Set tag for docker release image
if: success() && startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }}" >> "$GITHUB_ENV"
- name: 🏷️ Set tag for docker master image
if: success() && ! startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest" >> "$GITHUB_ENV"
- name: 🛠️ Build and export to docker
uses: docker/build-push-action@v5
with:
context: ./dist/${{ env.TEMPLATE }}
load: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}
- name: 🧪 Test docker image
run: |
export IMAGE_TAG=${{ env.IMAGE_TAG }}; make test
- name: 📤 Push docker image
uses: docker/build-push-action@v5
with:
context: ./dist/${{ env.TEMPLATE }}
### For Cross Platform OSX builds uncomment these lines
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ env.IMAGE_TAG }}
cache-to: type=inline
...