diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/build_image.yml similarity index 62% rename from .github/workflows/dockerimage.yml rename to .github/workflows/build_image.yml index e5f1e85..181950a 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/build_image.yml @@ -1,8 +1,8 @@ -name: Docker Image MKDocs +name: Build & Test MKDocs on: push: - branches: [ master, issue/* ] + branches: [ issue/*, feature/* ] pull_request: branches: [ master ] @@ -18,16 +18,9 @@ jobs: run: | export RELEASE=$(grep "MKDOCS_VERSION=" Dockerfile | sed 's|^.*=||g' |awk '{print $1}' | sed 's|"||g') docker build . --file Dockerfile --tag polinux/mkdocs:${RELEASE} - docker images - name: Test image run: | export RELEASE=$(grep "MKDOCS_VERSION=" Dockerfile | sed 's|^.*=||g' |awk '{print $1}' | sed 's|"||g') docker run -d --cap-add NET_ADMIN -p 8000:8000 --name mkdocs polinux/mkdocs:${RELEASE} sleep 10 curl -sSLi http://127.0.0.1:8000 | grep '200 OK' - - name: Deploy image - if: ${{github.branch == 'master'}} - run: | - export RELEASE=$(grep "MKDOCS_VERSION=" Dockerfile | sed 's|^.*=||g' |awk '{print $1}' | sed 's|"||g') - docker login -u ${{ secrets.DOCKER_HUB_USER }} -p ${{ secrets.DOCKER_HUB_PASS }} - docker push polinux/mkdocs:${RELEASE} \ No newline at end of file diff --git a/.github/workflows/deploy_image.yml b/.github/workflows/deploy_image.yml new file mode 100644 index 0000000..8c3a8e8 --- /dev/null +++ b/.github/workflows/deploy_image.yml @@ -0,0 +1,20 @@ +name: Deploy MKDocs + +on: + push: + branches: [ master ] + +jobs: + + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy image + run: | + export RELEASE=$(grep "MKDOCS_VERSION=" Dockerfile | sed 's|^.*=||g' |awk '{print $1}' | sed 's|"||g') + docker build . --file Dockerfile --tag polinux/mkdocs:${RELEASE} + docker login -u ${{ secrets.DOCKER_HUB_USER }} -p ${{ secrets.DOCKER_HUB_PASS }} + docker push polinux/mkdocs:${RELEASE} \ No newline at end of file