Commit 777c4510 by Moikot

Add DOCKER_IMAGE secret

parent 4b6208ac
...@@ -19,7 +19,6 @@ jobs: ...@@ -19,7 +19,6 @@ jobs:
name: Prepare name: Prepare
id: prep id: prep
run: | run: |
DOCKER_IMAGE=quay.io/external_storage/nfs-subdir-external-provisioner
if [[ $GITHUB_REF == refs/tags/* ]]; then if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/} VERSION=${GITHUB_REF#refs/tags/}
if [[ $VERSION =~ ^v([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then if [[ $VERSION =~ ^v([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
...@@ -27,21 +26,21 @@ jobs: ...@@ -27,21 +26,21 @@ jobs:
MINOR="${BASH_REMATCH[2]}" MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}" PATCH="${BASH_REMATCH[3]}"
TAGS="${DOCKER_IMAGE}:latest" TAGS="${{ secrets.DOCKER_IMAGE }}:latest"
TAGS="${TAGS},${DOCKER_IMAGE}:${MAJOR}" TAGS="${TAGS},${{ secrets.DOCKER_IMAGE }}:${MAJOR}"
TAGS="${TAGS},${DOCKER_IMAGE}:${MAJOR}.${MINOR}" TAGS="${TAGS},${{ secrets.DOCKER_IMAGE }}:${MAJOR}.${MINOR}"
TAGS="${TAGS},${DOCKER_IMAGE}:${MAJOR}.${MINOR}.${PATCH}" TAGS="${TAGS},${{ secrets.DOCKER_IMAGE }}:${MAJOR}.${MINOR}.${PATCH}"
else else
TAGS="${DOCKER_IMAGE}:${VERSION}" TAGS="${{ secrets.DOCKER_IMAGE }}:${VERSION}"
fi fi
elif [[ $GITHUB_REF == refs/heads/* ]]; then elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=edge VERSION=edge
fi fi
TAGS="${DOCKER_IMAGE}:${VERSION}" TAGS="${{ secrets.DOCKER_IMAGE }}:${VERSION}"
elif [[ $GITHUB_REF == refs/pull/* ]]; then elif [[ $GITHUB_REF == refs/pull/* ]]; then
TAGS="${DOCKER_IMAGE}:pr-${{ github.event.number }}" TAGS="${{ secrets.DOCKER_IMAGE }}:pr-${{ github.event.number }}"
fi fi
echo ::set-output name=tags::${TAGS} echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
...@@ -70,7 +69,7 @@ jobs: ...@@ -70,7 +69,7 @@ jobs:
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }} tags: ${{ steps.prep.outputs.tags }}
build-args: | build-args: |
APP_FOLDER=/go/src/github.com/kubernetes-sigs/nfs-subdir-external-provisioner APP_FOLDER="/go/src/github.com/$GITHUB_REPOSITORY"
labels: | labels: |
org.opencontainers.image.title=${{ github.event.repository.name }} org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }} org.opencontainers.image.description=${{ github.event.repository.description }}
......
...@@ -182,11 +182,11 @@ spec: ...@@ -182,11 +182,11 @@ spec:
# Build and publish with GitHub Actions # Build and publish with GitHub Actions
In a forked repository you can use GitHub Actions pipeline defined in [.github/workflows/release.yml](.github/workflows/release.yml). The pipeline builds Docker images for `linux/amd64`, `linux/arm64`, and `linux/arm/v7` platforms and publishes them using a multi-arch manifest attaching tags according to next rules: In a forked repository you can use GitHub Actions pipeline defined in [.github/workflows/release.yml](.github/workflows/release.yml). The pipeline builds Docker images for `linux/amd64`, `linux/arm64`, and `linux/arm/v7` platforms and publishes them using a multi-arch manifest attaching tags according to the next rules:
* For master branch it uses `:edge` tag and pushes images to the registry. * For the master branch, it uses `:edge` tag and pushes images to the registry.
* For any other branch except master, it uses the branch name as the tag name replacing `/`s with `-`s, and pushes to the registry. * For any other branch except master, it uses the branch name as the tag name replacing `/`s with `-`s, and pushes to the registry.
* For any tag matching patter `v{major}.{minor}.{patch}` it creates several tags: `latest`, `{major}`, `{major}:{minor}`, `{major}:{minor}:{patch}` and pushes to the registry. For any other tag, it uses the tag's name as the image tag and pushes too. * For any tag matching patter `v{major}.{minor}.{patch}` it creates several tags: `latest`, `{major}`, `{major}:{minor}`, `{major}:{minor}:{patch}` and pushes to the registry. For any other tag, it uses the tag's name as the image tag and pushes too.
* For pull requests it uses ephemeral `:pr-{github.event.number}` tags, builds the images but doesn't push to the registry. * For pull requests, it uses ephemeral `:pr-{github.event.number}` tags, builds the images but doesn't push to the registry.
The pipeline adds several labels: The pipeline adds several labels:
* `org.opencontainers.image.title=${{ github.event.repository.name }}` * `org.opencontainers.image.title=${{ github.event.repository.name }}`
...@@ -198,5 +198,5 @@ The pipeline adds several labels: ...@@ -198,5 +198,5 @@ The pipeline adds several labels:
* `org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}` * `org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}`
**Important:** **Important:**
* The pipeline performs the docker login command using `REGISTRY_USERNAME` and `REGISTRY_TOKEN` secrets which have to be provided. * The pipeline performs the docker login command using `REGISTRY_USERNAME` and `REGISTRY_TOKEN` secrets, which have to be provided.
* You also need to replace `quay.io/external_storage/nfs-subdir-external-provisioner` with your image name. * You also need to provide the `DOCKER_IMAGE` secret specifying your Docker image name, e.g., `quay.io/[username]/nfs-subdir-external-provisioner`.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment