diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 253178b7..64049490 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: inputs: version: description: Build with the given version. - default: v1.0.0 + default: 0.1.0 required: true app: type: choice @@ -81,6 +81,13 @@ jobs: org.opencontainers.image.name=${{ env.IMAGE_NAME }} org.opencontainers.image.title=${{ env.SCOPE }} org.opencontainers.image.authors=Sumanth + tags: | + ## only enabled for v* tags: + type=semver,pattern={{ version }},enable=${{ startsWith(github.ref, 'refs/tags/v') }} + ## only enabled on workflow_dispatch: + type=semver,pattern={{version}},prefix=v,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }} + ## only enabled in main branch: + type=raw,value=latest,enable={{is_default_branch}} - name: Build and push Docker image uses: docker/build-push-action@v5 with: diff --git a/docs/docker.md b/docs/docker.md index 6383b786..db3199de 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -108,3 +108,11 @@ Verify the image with Keyless mode #nerdctl pull --verify=cosign ghcr.io/xmlking/spectacular:$VERSION COSIGN_EXPERIMENTAL=1 cosign verify $DOCKER_IMAGE:$VERSION ``` + +### GitHub Action +Build environment variables are needed during docker build in `GitHub Action` +**TODO:** pass `GitHub Sectets` as described in `Reference` and [example 1](https://github.com/SSHOC/gl-autodevops-minimal-port/blob/main/.github/workflows/build-herokuish-and-push-to-registry.yaml#L95) + +## Reference +- [Sharing environment variables using Github Action secrets](https://andrei-calazans.com/posts/2021-06-23-passing-secrets-github-actions-docker/) +- [How to use Github Action secrets with your Docker image](https://medium.com/@brian978_dev/effortlessly-secure-passing-secrets-from-github-to-your-docker-image-f1df3b6d0e49)