refactor: reuse url function #3722
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: docker | |
on: | |
workflow_call: | |
inputs: | |
is_main_build: | |
type: boolean | |
required: true | |
pull_request: | |
branches: | |
- main | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download bumped version artifacts | |
if: inputs.is_main_build | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-data | |
# If not main build, create .env file with APP_GIT_REF | |
- name: Create .env file | |
if: inputs.is_main_build != true | |
run: | | |
echo "APP_GIT_REF=${{ github.sha }}" >> .env | |
- name: Docker meta | |
id: metal | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.metal.outputs.tags }} | |
labels: ${{ steps.metal.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |