-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
CrazyMax
committed
Sep 28, 2020
1 parent
ff640d3
commit 2b832c5
Showing
2 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| # Upgrade notes | ||
|
|
||
| ## v1 to v2 | ||
|
|
||
| * Rename `path` input to `context` | ||
| * Rename `dockerfile` input to `file` | ||
| * Rename `always_pull` input to `pull` | ||
| * Add `builder` input to be able to choose a builder instance through our [setup-buildx action](https://github.com/docker/setup-buildx-action) | ||
| * Add [`platforms`](https://github.com/docker/buildx#---platformvaluevalue) input | ||
| * Add [`allow`](https://github.com/docker/buildx#--allowentitlement) input | ||
| * Add [`load`](https://github.com/docker/buildx#--load) input | ||
| * Add [`outputs`](https://github.com/docker/buildx#-o---outputpath-typetypekeyvalue) input | ||
| * Add [`cache-from`](https://github.com/docker/buildx#--cache-fromnametypetypekeyvalue) input (`cache_froms` removed) | ||
| * Add [`cache-to`](https://github.com/docker/buildx#--cache-tonametypetypekeyvalue) input | ||
| * Add `secrets` input | ||
| * Review `tags` input | ||
| * Remove `repository` input. See [Simple workflow](#simple-workflow) for migration | ||
| * Remove `username`, `password` and `registry` inputs. Login support moved to [docker/login-action](https://github.com/docker/login-action) repo | ||
| * Remove `tag_with_sha`, `tag_with_ref`, `add_git_labels` inputs. See [Tags with ref and Git labels](#tags-with-ref-and-git-labels) for migration | ||
| * Handle Git context | ||
| * Add `digest` output | ||
|
|
||
| ### Simple workflow | ||
|
|
||
| ```yaml | ||
| # v1 | ||
| steps: | ||
| - | ||
| name: Checkout code | ||
| uses: actions/checkout@v2 | ||
| - | ||
| name: Build and push Docker images | ||
| uses: docker/build-push-action@v1 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| repository: myorg/myrepository | ||
| always_pull: true | ||
| build_args: arg1=value1,arg2=value2 | ||
| cache_froms: myorg/myrepository:latest | ||
| tags: latest | ||
| ``` | ||
| ```yaml | ||
| # v2 | ||
| steps: | ||
| - | ||
| name: Checkout code | ||
| uses: actions/checkout@v2 | ||
| - | ||
| name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v1 | ||
| - | ||
| name: Login to DockerHub | ||
| uses: docker/login-action@v1 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| - | ||
| name: Build and push | ||
| uses: docker/build-push-action@v2 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| pull: true | ||
| push: true | ||
| build-args: arg1=value1,arg2=value2 | ||
| cache-from: type=registry,ref=myorg/myrepository | ||
| cache-to: type=registry,ref=myorg/myrepository | ||
| tags: myorg/myrepository:latest | ||
| ``` | ||
| ### Tags with ref and Git labels | ||
| ```yaml | ||
| # v1 | ||
| steps: | ||
| - | ||
| name: Checkout code | ||
| uses: actions/checkout@v2 | ||
| - | ||
| name: Build and push Docker images | ||
| uses: docker/build-push-action@v1 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| repository: myorg/myrepository | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tag_with_ref: true | ||
| tag_with_sha: true | ||
| ``` | ||
| ```yaml | ||
| # v2 | ||
| steps: | ||
| - | ||
| name: Checkout | ||
| uses: actions/checkout@v2 | ||
| - | ||
| name: Prepare | ||
| id: prep | ||
| run: | | ||
| DOCKER_IMAGE=myorg/myrepository | ||
| VERSION=edge | ||
| if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
| VERSION=${GITHUB_REF#refs/tags/} | ||
| elif [[ $GITHUB_REF == refs/heads/* ]]; then | ||
| VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') | ||
| elif [[ $GITHUB_REF == refs/pull/* ]]; then | ||
| VERSION=pr-${{ github.event.number }} | ||
| fi | ||
| TAGS="${DOCKER_IMAGE}:${VERSION}" | ||
| if [ "${{ github.event_name }}" = "push" ]; then | ||
| TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}" | ||
| fi | ||
| echo ::set-output name=version::${VERSION} | ||
| echo ::set-output name=tags::${TAGS} | ||
| echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
| - | ||
| name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v1 | ||
| - | ||
| name: Login to DockerHub | ||
| if: github.event_name != 'pull_request' | ||
| uses: docker/login-action@v1 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| - | ||
| name: Build and push | ||
| uses: docker/build-push-action@v2 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.prep.outputs.tags }} | ||
| labels: | | ||
| org.opencontainers.image.source=${{ github.event.repository.clone_url }} | ||
| org.opencontainers.image.created=${{ steps.prep.outputs.created }} | ||
| org.opencontainers.image.revision=${{ github.sha }} | ||
| ``` |