mirror of
https://github.com/opencontainers/distribution-spec.git
synced 2026-02-05 18:45:11 +01:00
- actions/checkout v3 -> v4 - actions/setup-go v3 -> v5 - docker/login-action v2 -> v3 - actions/upload-artifact v3 -> v4 - Replace deprecated set-output with $GITHUB_OUTPUT file Signed-off-by: Brandon Mitchell <git@bmitch.net>
64 lines
2.2 KiB
YAML
64 lines
2.2 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Prepare
|
|
id: prepare
|
|
run: |
|
|
VERSION=${GITHUB_REF#refs/*/}
|
|
IMAGE=ghcr.io/${{ github.repository }}/conformance
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
elif [[ $GITHUB_REF == refs/heads/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/heads/}
|
|
fi
|
|
VERSION=$(echo "${VERSION}" | sed -r 's#/+#-#g')
|
|
TAGS="${IMAGE}:${VERSION}"
|
|
if [[ $VERSION == "${{ github.event.repository.default_branch }}" ]]; then
|
|
GITSHA="$(git rev-parse --short HEAD)"
|
|
TAGS="${TAGS},${IMAGE}:${GITSHA}"
|
|
fi
|
|
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
|
MINOR=${VERSION%.*}
|
|
MAJOR=${MINOR%.*}
|
|
TAGS="${TAGS},${IMAGE}:${MINOR},${IMAGE}:${MAJOR}"
|
|
fi
|
|
echo "version=${VERSION}" >>$GITHUB_OUTPUT
|
|
echo "tags=${TAGS}" >>$GITHUB_OUTPUT
|
|
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>$GITHUB_OUTPUT
|
|
|
|
- name: Docker Login
|
|
uses: docker/login-action@v3
|
|
if: github.repository_owner == 'opencontainers'
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ secrets.GHCR_USER }}
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: conformance/
|
|
# platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
|
|
push: ${{ github.event_name != 'pull_request' && github.repository_owner == 'opencontainers' }}
|
|
tags: ${{ steps.prepare.outputs.tags }}
|
|
build-args: |
|
|
VERSION=${{ steps.prepare.outputs.version }}
|
|
labels: |
|
|
org.opencontainers.image.created=${{ steps.prepare.outputs.created }}
|
|
org.opencontainers.image.source=${{ github.repositoryUrl }}
|
|
org.opencontainers.image.version=${{ steps.prepare.outputs.version }}
|
|
org.opencontainers.image.revision=${{ github.sha }}
|