Retry running the build #151
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 and Publish Docker Image | |
on: | |
push: | |
branches: | |
- main | |
- development | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
lowercase: ${{ steps.lowercase.outputs.LOWERCASE }} | |
is_pr: ${{ steps.pr.outputs.IS_PR }} | |
tag_name: ${{ steps.tag.outputs.TAG_NAME }} | |
profile_manifest: ${{ steps.manifest.outputs.PROFILE_MANIFEST }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Make dockerfiles | |
run: make | |
- name: Convert repository owner to lowercase | |
id: lowercase | |
run: echo "LOWERCASE=$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')" >> $GITHUB_OUTPUT | |
- name: Check if currently in a pull request | |
id: pr | |
run: echo "IS_PR=$(test -n "${{ github.event.pull_request }}" && echo "true" || echo "false")" >> $GITHUB_OUTPUT | |
- name: Create the tag name | |
id: tag | |
run: | | |
if [[ "${{ github.ref_name }}" == "main" ]]; then | |
echo "TAG_NAME=latest" >> $GITHUB_OUTPUT | |
else | |
if [[ "${{ steps.pr.outputs.IS_PR }}" == "true" ]]; then | |
echo "TAG_NAME=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
else | |
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
fi | |
fi | |
- name: Read profile manifest | |
id: manifest | |
run: | | |
escaped_manifest=$(jq -c . profiles/dist/manifest.json) | |
echo "PROFILE_MANIFEST=$escaped_manifest" >> $GITHUB_OUTPUT | |
code: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push code | |
uses: docker/build-push-action@v5 | |
with: | |
context: code | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ needs.setup.outputs.lowercase }}/code:${{ needs.setup.outputs.tag_name }} | |
code-insiders: | |
runs-on: ubuntu-latest | |
needs: setup | |
if: ${{ github.ref_name }} == 'main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push code | |
uses: docker/build-push-action@v5 | |
with: | |
context: code | |
push: true | |
build-args: | | |
CODE_INSIDERS=true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ needs.setup.outputs.lowercase }}/code:insiders-${{ needs.setup.outputs.tag_name }} | |
profiles: | |
runs-on: ubuntu-latest | |
needs: [setup, code] | |
if: ${{ github.ref_name }} == 'main' | |
strategy: | |
matrix: | |
release: [code] | |
profile: ${{ fromJson(needs.setup.outputs.profile_manifest) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Make dockerfiles | |
run: make | |
- name: List files | |
run: ls profiles/dist/${{ matrix.release }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push code | |
uses: docker/build-push-action@v5 | |
with: | |
context: profiles/dist/${{ matrix.release }} | |
file: profiles/dist/${{ matrix.release }}/Dockerfile.${{ matrix.profile }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ needs.setup.outputs.lowercase }}/code:${{ matrix.profile }} | |
cache-from: type=gha,scope=${{ matrix.release }}-${{ matrix.profile }} | |
cache-to: type=gha,mode=max,scope=${{ matrix.release }}-${{ matrix.profile }} |