docs: mark "shell-format" has been stopped to use #66
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
# Based on: | |
# Publishing Docker images - GitHub Docs | |
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images | |
name: Build and publish | |
on: | |
release: | |
types: [published] | |
push: | |
branches: [mian, dev] # always make changes on dev and make PR to mian | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
# https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/ | |
concurrency: | |
group: std::lock_guard | |
timeout-minutes: 5 | |
steps: | |
- | |
name: Get the name of this repo | |
id: repo-name | |
run: echo "output=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT | |
- | |
name: Check out the repo | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
# Cache management with GitHub Actions | Docker Docs | |
# https://docs.docker.com/build/ci/github-actions/cache/ | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- | |
name: Log in to Docker Hub | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Log in to GitHub Packages | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 | |
with: | |
images: | | |
${{ github.repository_owner }}/${{ steps.repo-name.outputs.output }} | |
ghcr.io/${{ github.repository }} | |
tags: ${{ github.event_name == 'push' && (github.ref_name == 'mian' && 'latest' || 'unstable') || '' }} | |
- | |
name: Build and push Docker images | |
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |