Merge branch 'release_24.1' into dev #1
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 Container Image | |
on: | |
push: | |
branches: | |
- dev | |
- release_* | |
tags: | |
- v* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
ghcrbuild: | |
name: Build container image for GHCR | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# https://stackoverflow.com/questions/59810838/how-to-get-the-short-sha-for-the-github-workflow | |
- name: Set outputs | |
id: commit | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Set branch name | |
id: branch | |
run: | | |
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then | |
echo "name=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
elif [[ "$GITHUB_REF" == "refs/heads/dev" ]]; then | |
echo "name=dev" >> $GITHUB_OUTPUT | |
elif [[ "$GITHUB_REF" == "refs/heads/release_"* ]]; then | |
echo "name=${GITHUB_REF#refs/heads/release_}-auto" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Extract metadata for container image | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=raw,value=${{steps.branch.outputs.name}} | |
- name: Build args | |
id: buildargs | |
run: | | |
echo "gitcommit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
echo "builddate=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64 | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push container image to ghcr | |
uses: docker/build-push-action@v4 | |
with: | |
build-args: | | |
GIT_COMMIT=${{ steps.buildargs.outputs.gitcommit }} | |
BUILD_DATE=${{ steps.buildargs.outputs.builddate }} | |
IMAGE_TAG=${{ steps.branch.outputs.name }} | |
file: .k8s_ci.Dockerfile | |
push: true | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64 | |
build: | |
name: Build container image for Galaxy repos | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'galaxyproject' | |
steps: | |
- uses: actions/checkout@v4 | |
# https://stackoverflow.com/questions/59810838/how-to-get-the-short-sha-for-the-github-workflow | |
- name: Set outputs | |
id: commit | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Set branch name | |
id: branch | |
run: | | |
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then | |
echo "name=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
elif [[ "$GITHUB_REF" == "refs/heads/dev" ]]; then | |
echo "name=dev" >> $GITHUB_OUTPUT | |
elif [[ "$GITHUB_REF" == "refs/heads/release_"* ]]; then | |
echo "name=${GITHUB_REF#refs/heads/release_}-auto" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Build container image | |
run: docker build . --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg IMAGE_TAG=${{ steps.branch.outputs.name }} -t galaxy/galaxy-min:${{ steps.branch.outputs.name }} -t quay.io/galaxyproject/galaxy-min:${{ steps.branch.outputs.name }} -f .k8s_ci.Dockerfile | |
- name: Create auto-expiring one for per-commit auto repository | |
run: echo "FROM galaxy/galaxy-min:${{ steps.branch.outputs.name }}" | docker build --label "quay.expires-after"="90d" -t "quay.io/galaxyproject/galaxy-k8s-auto:${{ steps.commit.outputs.sha_short }}" - | |
- name: Login to quay.io | |
uses: actions-hub/docker/login@master | |
env: | |
DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.QUAY_PASSWORD }} | |
DOCKER_REGISTRY_URL: quay.io | |
- name: Push to quay.io with branch name | |
uses: actions-hub/docker@master | |
with: | |
args: push quay.io/galaxyproject/galaxy-min:${{ steps.branch.outputs.name }} | |
- name: Push to quay.io with commit hash | |
uses: actions-hub/docker@master | |
with: | |
args: push quay.io/galaxyproject/galaxy-k8s-auto:${{ steps.commit.outputs.sha_short }} | |
- name: Login to DockerHub | |
uses: actions-hub/docker/login@master | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push to DockerHub with branch name | |
uses: actions-hub/docker@master | |
with: | |
args: push galaxy/galaxy-min:${{ steps.branch.outputs.name }} | |