Skip to content

Http std lib mux

Http std lib mux #31

name: "build & push docker staging"
on:
pull_request_target:
branches: [main]
types:
- closed
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
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: Setup golang environment
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install dependencies
run: go mod tidy
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_ENDPOINT }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: set build env variables
shell: bash
run: |
REPO_VERSION=$(git rev-parse --git-dir > /dev/null 2>&1 && git fetch -q origin --tags && git describe --always --dirty --tags)
REPO_REV=$(git rev-parse --git-dir > /dev/null 2>&1 && git rev-parse HEAD 2>/dev/null)
BUILD_DATE=$(date -u +%FT%T)
echo "REPO_VERSION=$REPO_VERSION" >> $GITHUB_ENV
echo "REPO_REV=$REPO_REV" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ env.REPO_VERSION }}
REPO_REV=${{ env.REPO_REV }}
DATE=${{ env.BUILD_DATE }}
tags: ${{ secrets.DOCKER_ENDPOINT }}${{ secrets.DOCKER_REPO }}/fishymetrics:${{ env.REPO_VERSION }}