mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-25 09:00:26 +00:00
Create docker.yml
This commit is contained in:
parent
6bb893f3eb
commit
79b7133526
1 changed files with 45 additions and 0 deletions
45
.github/workflows/docker.yml
vendored
Normal file
45
.github/workflows/docker.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
name: Docker Build And Push To Docker Hub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'Dockerfile'
|
||||
- 'cmd.sh'
|
||||
- 'entrypoint.sh'
|
||||
tags:
|
||||
- v**
|
||||
jobs:
|
||||
build:
|
||||
name: Build Docker image
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TAGS: latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
name: Check out code
|
||||
|
||||
- name: Set appname
|
||||
run: |
|
||||
repo=${{github.event.repository.name}}
|
||||
arrayrepo=(${repo//-/ })
|
||||
APP_NAME=${arrayrepo[1]}
|
||||
echo "APP_NAME=${APP_NAME}" >> $GITHUB_ENV
|
||||
|
||||
- name: Get all tags when release a tag
|
||||
if: contains(github.ref_name, 'v')
|
||||
run: |
|
||||
tmptag=${{ github.ref_name}}
|
||||
arraytag=(${tmptag//./ })
|
||||
TAGS=${arraytag[0]},${arraytag[0]}.${arraytag[1]},${{ github.ref_name}},latest
|
||||
echo "TAGS=${TAGS}" >> $GITHUB_ENV
|
||||
|
||||
- uses: mr-smithers-excellent/docker-build-push@v5
|
||||
name: Build & push Docker image
|
||||
with:
|
||||
image: websoft9dev/${{env.APP_NAME}}
|
||||
tags: ${{env.TAGS}}
|
||||
registry: docker.io
|
||||
dockerfile: Dockerfile
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
Loading…
Reference in a new issue