update actions versions #7
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 Docker image" | |
on: | |
push: | |
branches: ['**'] | |
release: | |
types: [released] | |
env: | |
IMAGE_NAME: "${{ secrets.DOCKER_ORG }}/geospaas_uwsgi" | |
jobs: | |
build_docker_image: | |
runs-on: 'ubuntu-20.04' | |
steps: | |
- name: 'Checkout repository' | |
uses: actions/checkout@v4 | |
- name: "Extract tag name" | |
id: get_version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]];then | |
TAG="${GITHUB_REF#refs/tags/}" | |
else | |
TAG='tmp' | |
fi | |
echo "::set-output name=VERSION::${TAG}" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
- name: Build docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ startsWith(github.ref, 'refs/tags/') }} | |
tags: | | |
${{ env.IMAGE_NAME }}:latest | |
${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
... |