Skip to content

ci: Fix workflow

ci: Fix workflow #2

Workflow file for this run

name: Build
on:
push:
tags: ['*']
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract tag name
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/} | sed 's#/#_#g')"
id: extract_refs
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Image
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ vars.ECS_REPOSITORY_NAME }}:${{ steps.extract_refs.outputs.tag }}
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
build_args: |
RUBY_VERSION=${{ steps.extract_refs.outputs.tag }}
- name: Push Image to Amazon ECR
id: ecr_sha_ruby
uses: jwalton/gh-ecr-push@v2
with:
access-key-id: ${{ vars.GH_AWS_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }}
region: eu-west-1
local-image: ${{ vars.ECS_REPOSITORY_NAME }}:${{ github.ref }}
image: ${{ vars.ECS_REPOSITORY_NAME }}:${{ steps.extract_refs.outputs.tag }}
-
# 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