Update actions/checkout action to v4 (#20) #74
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: 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@v4 | |
- 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 |