Merge remote-tracking branch 'refs/remotes/origin/main' #126
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: Create and publish a Docker image | |
on: | |
push: | |
branches: | |
- main | |
- stable | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: dataspecer/ws | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch the full history for git describe | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: dataspecer | |
password: ${{ secrets.GHCR_DATASPECER }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,event=branch | |
- name: Get commit metadata | |
id: commit_meta | |
run: | | |
COMMIT_DATE=$(git log -1 --format=%cd --date=iso) | |
COMMIT_NUMBER=$(git rev-list --count HEAD) | |
echo "COMMIT_DATE=${COMMIT_DATE}" >> $GITHUB_ENV | |
echo "COMMIT_NUMBER=${COMMIT_NUMBER}" >> $GITHUB_ENV | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./docker-ws/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
GIT_COMMIT=${{ github.sha }} | |
GIT_REF=${{ github.ref }} | |
GIT_COMMIT_DATE=${{ env.COMMIT_DATE }} | |
GIT_COMMIT_NUMBER=${{ env.COMMIT_NUMBER }} |