Workflow file for this run
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 Haproxy 2.9 with Docker Buildx | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [linux/amd64, linux/arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Prepare | |
id: prep | |
run: echo ::set-output name=tag::$(echo ${{ matrix.platform }} | tr '/' '-') | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: ${{ matrix.platform }} | |
push: true | |
tags: eltorio/haproxy:2.9-${{ steps.prep.outputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Extract .deb file | |
run: | | |
docker pull eltorio/haproxy:2.9-${{ steps.prep.outputs.tag }} | |
docker run --rm --platform ${{ matrix.platform }} --entrypoint cat eltorio/haproxy:2.9-${{ steps.prep.outputs.tag }} /haproxy.deb > haproxy-${{ steps.prep.outputs.tag }}.deb | |
- name: Upload .deb file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: haproxy-deb-${{ steps.prep.outputs.tag }} | |
path: haproxy-${{ steps.prep.outputs.tag }}.deb | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [linux-amd64, linux-arm64] | |
steps: | |
- name: Get release | |
id: get_release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const release = await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag: context.ref.replace('refs/tags/', '') | |
}); | |
return release.data.id; | |
- name: Download .deb file | |
uses: actions/download-artifact@v4 | |
with: | |
name: haproxy-deb-${{ matrix.platform }} | |
- name: Upload Release Asset | |
run: | | |
gh release upload ${{ github.ref }} ./haproxy-deb-${{ matrix.platform }}.deb --repo ${{ github.repository }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |