Skip to content

Instantly share code, notes, and snippets.

@myl7
Created April 13, 2022 13:09
Show Gist options
  • Save myl7/c1db081d640b119a51c4f92fabd21ecd to your computer and use it in GitHub Desktop.
Save myl7/c1db081d640b119a51c4f92fabd21ecd to your computer and use it in GitHub Desktop.
GitHub Actions Docker CD template
name: CI with CD
on:
push:
branches:
- main
release:
types:
- published
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: meta
uses: docker/metadata-action@v3
with:
images: <image name like myl7/tgchan-bookmark-bot>
tags: |
type=edge
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.authors=<contact like myl7 <[email protected]>>
org.opencontainers.image.documentation=<repo readme or others like https://github.com/myl7/tgchan-bookmark-bot#readme>
<CI steps>
- uses: docker/login-action@v1
with:
username: <Docker Hub username>
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: . # Required if you need the modified files after CI, otherwise optional
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment