Comments (8)
I usually publish bleeding-edge changes of the master
branch with master
tag and reserve the latest
for when the repo is tagged. This way, people who pull my images without explicit tags can always get something that I explicitly released.
- on push to a branch
- build image with the branch name as the image tag
- on release/repo tag
- build image with the tag ref as the image tag
- build image with
latest
tag
from build-push-action.
I think this also fixes #40, since we'd be able to define custom conditions for pushing latest
, such as the branch name.
Something like:
tag_with_latest: ${{ github.ref == 'refs/heads/develop' && github.event_name == 'push' }}
from build-push-action.
@ibnesayeed yeah, this is also my intended behavior that will be possible with this feature suggestion.
# Use the following if you just push as latest when push git tags
tag_with_latest: ${{ startsWith(github.ref, 'refs/tags/') }}
from build-push-action.
Ok, I wrongly thought there was a boolean input called latest
already. I rewrote the Issue/Feature Request.
from build-push-action.
Great workflow suggestion. However isn't this solvable outside this extension? Simply don't run the action unless there is a tag set.
from build-push-action.
Right, but what to do if we want to run the action in both cases, but only push as latest when is a tag? Without this feature, we would at least have to create 2 (and mainly duplicated) different jobs.
from build-push-action.
I like the idea, personally I was surprised to see that master will also be tagged as latest. As a workaround I have two separate docker steps.
One for the regular CI jobs:
on:
push:
branches:
- master
pull_request:
#...
- name: Determine tag
uses: haya14busa/action-cond@v1
id: imagetag
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.sha }}
if_false: "master"
- name: Build
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: sagikazarmark/myrepo
tags: ${{ steps.imagetag.outputs.value }}
add_git_labels: true
push: ${{ github.event_name == 'push' }}
And one for releases:
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: sagikazarmark/myrepo
tags: latest
tag_with_ref: true
add_git_labels: true
from build-push-action.
Solved by #119. See https://github.com/docker/build-push-action#complete-workflow
from build-push-action.
Related Issues (20)
- Docker file created is different than Docker file created at own terminal HOT 1
- Merge Multi-Platform Image w/ Imagetools Create: Pull Access Denied HOT 3
- Provenance ignored when set to false If Buildx version is not provided HOT 10
- Allow grouping output for the `docker buildx build` step after `Buildx version` step HOT 2
- Docker: Cannot create container for service: No command specified HOT 1
- Self-signed certificates do not work HOT 4
- Build/Push fails if the tag name matches an existing tag in the registry HOT 5
- The sha256 of registry cache config are mismatched for rerun multi-stage config. HOT 1
- buildx failed with: ERROR: invalid key-value pair "": empty key HOT 2
- Tarball output throws `ResourceExhausted` error HOT 4
- GIT context ignores changes in build secrets and use GHA build cache from other build HOT 8
- When using a matrix for multi-platform builds images get erased HOT 2
- Docker Hub login succeeds but push does not HOT 1
- Local cache remains empty despite cache-to and cache-from configuration HOT 4
- Support push and load being set together HOT 5
- header key "followpaths" contains value with non-printable ASCII characters HOT 9
- Request for new release HOT 1
- Action hangs after build HOT 3
- net/http: TLS handshake timeout HOT 1
- GHA/Local cache doesn't work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from build-push-action.