mirror of https://github.com/1N3/Sn1per.git
test build and push
This commit is contained in:
parent
a91580b75f
commit
16d201b017
|
|
@ -1,23 +1,50 @@
|
||||||
name: publish
|
name: Build and Push docker
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- development
|
||||||
|
- feat*
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-to-ghcr:
|
deploy-docker-hello-world:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v1
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
images: ${{ env.REGISTRY}}/${ env.IMAGE_NAME,, }
|
||||||
|
flavor: latest=true
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
|
- name: Login to image repository
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Build the hello-docker Docker image
|
|
||||||
run: |
|
- name: Build and push
|
||||||
echo "Builing and push..."
|
uses: docker/build-push-action@v3
|
||||||
repo_name=${{ github.repository }}
|
with:
|
||||||
repo_name=${repo_name,,}
|
context: .
|
||||||
docker build . -f Dockerfile.base --tag ghcr.io/${repo_name}:latest
|
file: Dockerfile
|
||||||
docker run ghcr.io/${repo_name}:latest
|
push: ${{ github.ref_type == 'tag' || github.ref_name == 'main' || startsWith(github.ref_name, 'feat-')}}
|
||||||
docker push ghcr.io/${repo_name}:latest
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
Loading…
Reference in New Issue