Skip to content

Update crazy-max/ghaction-docker-buildx action to v3 (#14) #68

Update crazy-max/ghaction-docker-buildx action to v3 (#14)

Update crazy-max/ghaction-docker-buildx action to v3 (#14) #68

---
name: folding-at-home
on:
push:
paths:
- ".github/workflows/folding-at-home.yml"
- "build/**"
pull_request:
paths:
- ".github/workflows/folding-at-home.yml"
- "build/**"
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
env:
VERSION: $(cat build/.version)
VERSION_MAJOR: $(cat build/.version | sed -E 's/\.([^.]*)$//')
BUILD_DATE: $(date -u +'%Y-%m-%dT%H:%M:%SZ')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v3
with:
version: latest
- name: Login to GitHub Docker Registry
run: echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Container Image
if: github.ref != 'refs/heads/master'
run: |
docker buildx build \
--platform linux/amd64 \
--build-arg=VERSION=${{ env.VERSION }} \
--build-arg=VERSION_MAJOR=${{ env.VERSION_MAJOR }} \
--build-arg=BUILD_DATE=${{ env.VERSION_MAJOR }} \
--build-arg=VCS_REF=${{ github.sha }} \
--tag stefancrain/folding-at-home:${{ github.sha }} \
-f ./build/Dockerfile \
./build/ \
--push
- name: Build Container Image
if: github.ref == 'refs/heads/master'
run: |
docker buildx build \
--platform linux/amd64 \
--build-arg=VERSION=${{ env.VERSION }} \
--build-arg=VERSION_MAJOR=${{ env.VERSION_MAJOR }} \
--build-arg=BUILD_DATE=${{ env.VERSION_MAJOR }} \
--build-arg=VCS_REF=${{ github.sha }} \
--tag stefancrain/folding-at-home:latest \
--tag stefancrain/folding-at-home:${{ env.VERSION }} \
-f ./build/Dockerfile \
./build/ \
--push