Archived
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: Build and Publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
tags: [ "v*" ]
|
|
paths-ignore:
|
|
- "README.md"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Determine Docker tags
|
|
id: vars
|
|
run: |
|
|
# Always tag with commit SHA
|
|
TAGS="ghcr.io/${{ github.repository_owner }}/opencloud-oidc-webfinger-proxy:${{ github.sha }}"
|
|
|
|
# If push to main → add :latest
|
|
if [[ "${GITHUB_REF_TYPE}" == "branch" && "${GITHUB_REF_NAME}" == "main" ]]; then
|
|
TAGS="$TAGS,ghcr.io/${{ github.repository_owner }}/opencloud-oidc-webfinger-proxy:latest"
|
|
fi
|
|
|
|
# If push of a version tag → add version tag (e.g. v1.0.0)
|
|
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
|
|
VERSION_TAG=${GITHUB_REF_NAME}
|
|
TAGS="$TAGS,ghcr.io/${{ github.repository_owner }}/opencloud-oidc-webfinger-proxy:${VERSION_TAG}"
|
|
fi
|
|
|
|
echo "TAGS=$TAGS" >> $GITHUB_ENV
|
|
echo "Docker tags to push:"
|
|
echo "$TAGS" | tr ',' '\n'
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
push: true
|
|
tags: ${{ env.TAGS }}
|
|
platforms: linux/amd64,linux/arm64 |