draft gui for constraints #287
Workflow file for this run
This file contains hidden or 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 and upload | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: 1 | |
IMAGE_NAME: aiidalab/qe | |
BUILDKIT_PROGRESS: plain | |
# Only cancel in-progress jobs for the same ref | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-amd: | |
# Run for push events on main or v* tags OR PRs, | |
# but skip PRs coming from a release branch (e.g. release/v25.04.0) | |
if: | | |
(github.event_name == 'push' && ( | |
startsWith(github.ref, 'refs/heads/main') || | |
startsWith(github.ref, 'refs/tags/v') | |
)) | |
|| | |
(github.event_name == 'pull_request' && | |
github.event.pull_request.head.repo.fork == false && | |
!startsWith(github.head_ref, 'release/')) | |
runs-on: ubuntu-latest | |
outputs: | |
base_tags_ghcr: ${{ steps.meta_ghcr.outputs.tags }} | |
base_tags_dockerhub: ${{ steps.meta_dockerhub.outputs.tags }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry π | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to DockerHub π | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
uses: docker/login-action@v2 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta (GHCR) π | |
id: meta_ghcr | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
name=ghcr.io/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=pr | |
type=edge,enable={{is_default_branch}} | |
type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
- name: Docker meta (DockerHub) π | |
id: meta_dockerhub | |
uses: docker/metadata-action@v5 | |
with: | |
images: docker.io/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=pr | |
type=edge,enable={{is_default_branch}} | |
type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
- name: Build and push AMD image | |
id: build_upload_amd | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: ${{ ! (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} | |
load: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }} | |
# Append "-amd" to the dynamically generated tags | |
tags: | | |
${{ steps.meta_ghcr.outputs.tags }}-amd, | |
${{ steps.meta_dockerhub.outputs.tags }}-amd | |
cache-to: type=gha,scope=${{ github.workflow }},mode=min | |
cache-from: type=gha,scope=${{ github.workflow }} | |
build-arm: | |
if: | | |
(github.event_name == 'push' && ( | |
startsWith(github.ref, 'refs/heads/main') || | |
startsWith(github.ref, 'refs/tags/v') | |
)) | |
|| | |
(github.event_name == 'pull_request' && | |
github.event.pull_request.head.repo.fork == false && | |
!startsWith(github.head_ref, 'release/')) | |
runs-on: ubuntu-24.04-arm | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry π | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to DockerHub π | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
uses: docker/login-action@v2 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta (GHCR) π | |
id: meta_ghcr | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
name=ghcr.io/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=pr | |
type=edge,enable={{is_default_branch}} | |
type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
- name: Docker meta (DockerHub) π | |
id: meta_dockerhub | |
uses: docker/metadata-action@v5 | |
with: | |
images: docker.io/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=pr | |
type=edge,enable={{is_default_branch}} | |
type=raw,value={{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
- name: Build and push ARM image | |
id: build_upload_arm | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/arm64 | |
push: ${{ ! (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} | |
load: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }} | |
tags: | | |
${{ steps.meta_ghcr.outputs.tags }}-arm, | |
${{ steps.meta_dockerhub.outputs.tags }}-arm | |
cache-to: type=gha,scope=${{ github.workflow }},mode=min | |
cache-from: type=gha,scope=${{ github.workflow }} | |
create-manifest: | |
if: | | |
(github.event_name == 'push' && ( | |
startsWith(github.ref, 'refs/heads/main') || | |
startsWith(github.ref, 'refs/tags/v') | |
)) | |
|| | |
(github.event_name == 'pull_request' && | |
github.event.pull_request.head.repo.fork == false && | |
!startsWith(github.head_ref, 'release/')) | |
runs-on: ubuntu-latest | |
needs: [build-amd, build-arm] | |
steps: | |
- name: Login to GitHub Container Registry π | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to DockerHub π | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
uses: docker/login-action@v2 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Create and push manifest for GHCR | |
run: | | |
BASE_TAG="${{ needs.build-amd.outputs.base_tags_ghcr }}" | |
docker buildx imagetools create -t ${BASE_TAG} ${BASE_TAG}-amd ${BASE_TAG}-arm | |
- name: Create and push manifest for DockerHub | |
run: | | |
BASE_TAG="${{ needs.build-amd.outputs.base_tags_dockerhub }}" | |
docker buildx imagetools create -t ${BASE_TAG} ${BASE_TAG}-amd ${BASE_TAG}-arm | |
# Create a βlatestβ manifest only if the tag is a proper release (not a) | |
- name: Create and push manifest for GHCR latest | |
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'a') && !contains(github.ref, 'b') && !contains(github.ref, 'rc') | |
run: | | |
docker buildx imagetools create -t ghcr.io/${{ env.IMAGE_NAME }}:latest \ | |
${{ needs.build-amd.outputs.base_tags_ghcr }}-amd \ | |
${{ needs.build-amd.outputs.base_tags_ghcr }}-arm | |
- name: Create and push manifest for DockerHub latest | |
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, 'a') && !contains(github.ref_name, 'b') && !contains(github.ref_name, | |
'rc') | |
run: | | |
docker buildx imagetools create -t docker.io/${{ env.IMAGE_NAME }}:latest \ | |
${{ needs.build-amd.outputs.base_tags_dockerhub }}-amd \ | |
${{ needs.build-amd.outputs.base_tags_dockerhub }}-arm |