Skip to content

Commit

Permalink
test action docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Qetesh committed May 21, 2024
1 parent 51a325e commit bf88ba3
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CDN_bestIP docker image

on:
push:
branches:
- Publishing-Docker-images
tags:
- "v*"
paths-ignore:
- "README.md"

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Save dev version info
run: |
HASH=$(git rev-parse --short=7 HEAD)
echo "dev-$HASH" > VERSION
- name: Save Tag version info
if: startsWith(github.ref, 'refs/tags/')
run: |
git describe --tags > VERSION
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit bf88ba3

Please sign in to comment.