diff --git a/.github/actions/build_and_push/action.yml b/.github/actions/build_and_push/action.yml new file mode 100644 index 0000000..3e1d145 --- /dev/null +++ b/.github/actions/build_and_push/action.yml @@ -0,0 +1,34 @@ +name: Sahred Docker image creation steps + +inputs: + image: + required: true + tag: + required: true + branch: + default: "master" + push: + default: false + +runs: + using: "composite" + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ inputs.branch }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + file: ./docker/${{ inputs.image }}/Dockerfile + context: "./docker/${{ inputs.image }}/" + push: ${{ inputs.push }} + tags: giohappy/${{ inputs.image }}:${{ inputs.tag }} diff --git a/.github/workflows/geoserver.yml b/.github/workflows/geoserver.yml deleted file mode 100644 index c79bf8d..0000000 --- a/.github/workflows/geoserver.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Geoserver Docker Image (Build and Push) - -env: - IMAGE: geoserver - -on: - push: - branches: [ "master" ] - paths: - - "docker/$IMAGE/**" - pull_request: - branches: [ "master" ] - paths: - - "docker/$IMAGE/**" - release: - types: [published] - tags: - - "$IMAGE_*" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - uses: winterjung/split@v2 - id: split - with: - separator: "_" - msg: ${{ github.ref }} - - name: Determine Tag - uses: haya14busa/action-cond@v1 - id: image_tag - with: - cond: ${{github.event_name == 'release'}} - if_true: ${{ steps.split.outputs._1 }} - if_false: "$IMAGE:latest" - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: ./docker/$IMAGE/Dockerfile - context: "./docker/$IMAGE/" - push: ${{github.event_name != 'pull_request'}} - tags: giohappy/$IMAGE:${{ steps.image_tag.outputs.value }} diff --git a/.github/workflows/geoserver_data_dir.yml b/.github/workflows/geoserver_data_dir.yml deleted file mode 100644 index 751350e..0000000 --- a/.github/workflows/geoserver_data_dir.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Geoserver Data dir conf Docker Image (Build and Push) - -on: - push: - branches: [ "master" ] - paths: - - "docker/geoserver_data_dir/**" - pull_request: - branches: [ "master" ] - paths: - - "docker/geoserver_data_dir/**" - release: - types: [published] - tags: - - geoserver_data_dir_* - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: ./docker/geoserver_data_dir/Dockerfile - context: "./docker/geoserver_data_dir/" - push: ${{github.event_name == 'push'}} - tags: giohappy/geoserver_data_dir:${{ github.ref }} diff --git a/.github/workflows/letsencrypt.yml b/.github/workflows/letsencrypt.yml deleted file mode 100644 index 9ee61f9..0000000 --- a/.github/workflows/letsencrypt.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Letsencrypt Docker Image (Build and Push) - -on: - push: - branches: [ "master" ] - paths: - - "docker/letsencrypt/**" - pull_request: - branches: [ "master" ] - paths: - - "docker/letsencrypt/**" - release: - types: [published] - tags: - - letsencrypt_* - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: ./docker/letsencrypt/Dockerfile - context: "./docker/letsencrypt/" - push: ${{github.event_name == 'push'}} - tags: giohappy/letsencrypt:${{ github.ref }} diff --git a/.github/workflows/nginx.yml b/.github/workflows/nginx.yml deleted file mode 100644 index 5f32011..0000000 --- a/.github/workflows/nginx.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Nginx Docker Image (Build and Push) - -on: - push: - branches: [ "master" ] - paths: - - "docker/nginx/**" - pull_request: - branches: [ "master" ] - paths: - - "docker/nginx/**" - release: - types: [published] - tags: - - nginx_* - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: ./docker/nginx/Dockerfile - context: "./docker/nginx/" - push: ${{github.event_name == 'push'}} - tags: giohappy/nginx:${{ github.ref }} diff --git a/.github/workflows/postgis.yml b/.github/workflows/postgis.yml index 19a6070..cec4ff1 100644 --- a/.github/workflows/postgis.yml +++ b/.github/workflows/postgis.yml @@ -9,10 +9,6 @@ on: branches: [ "master" ] paths: - "docker/postgis/**" - release: - types: [published] - tags: - - postgis_* jobs: build: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..999e23b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: Docker Image (Build and Push) + +on: + release: + types: [published] + +jobs: + if: ${{ contains(github.ref, 'geoserver_') }} + geoserver: + runs-on: ubuntu-latest + steps: + - uses: winterjung/split@v2 + id: split + with: + separator: "_" + msg: ${{ github.ref }} + - uses: ./.github/actions/build_and_push + with: + image: "geoserver" + branch: ${{ github.ref }} + tag: ${{ steps.split.outputs._1 }} + push: false