Skip to content

feat: deleted travis CI and added github action support #9

feat: deleted travis CI and added github action support

feat: deleted travis CI and added github action support #9

Workflow file for this run

name: Docker Image Push
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
alpine_version: ["3.18", "3.19", "3.20", "3.21"]
beanstalkd_version: ["v1.8", "v1.9", "v1.10", "v1.11", "v1.12", "v1.13"]
platform: ["linux/amd64", "linux/arm64"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
ALPINE_VERSION=${{ matrix.alpine_version }}
BEANSTALKD_VERSION=${{ matrix.beanstalkd_version }}
context: .
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ github.repository }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
- name: Export digest
if: github.event_name != 'pull_request'
run: |
mkdir -p /tmp/digests/${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}/${digest#sha256:}"
- name: Upload digest
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs:
- build
strategy:
fail-fast: false
matrix:
alpine_version: ["3.17", "3.18", "3.19", "3.20"]
beanstalkd_version: ["v1.8", "v1.9", "v1.10", "v1.11", "v1.12", "v1.13"]
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests/${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}
pattern: digests-${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests/${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}
run: |
docker buildx imagetools create -t ${{ github.repository }}:${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }} \
$(printf '${{ github.repository }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ github.repository }}:${{ matrix.beanstalkd_version }}-alpine-${{ matrix.alpine_version }}