From 0162dfa36095cbad4e1a5ed156ac8e9d6a56ca68 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Mon, 25 Sep 2023 12:34:49 -0400 Subject: [PATCH 1/4] Added git workflow to build and publish dev docker image --- .dockerignore | 13 +++++++++++ .github/workflows/docker-dev.yml | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker-dev.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..a600a88e3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +bump_version.sh +docker +docs +*.git +*.gitignore +includes/settings.php +java +Makefile +release-files +tests +TODO +vendor +ws diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml new file mode 100644 index 000000000..36d9d77bc --- /dev/null +++ b/.github/workflows/docker-dev.yml @@ -0,0 +1,38 @@ +name: Publish Dev Docker Image + +on: + push: + branches: + - master + +jobs: + push_dev_to_registry: + name: Push Development Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract Commit Hash + id: extract_hash + run: echo "::set-output name=hash::$(git rev-parse --short HEAD)" + + - name: Get WebCalendar Version + run: echo "WEBCALENDAR_VERSION=$(./bump_version.sh -p)" >> $GITHUB_ENV + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + file: ./docker/Dockerfile-php8 + push: true + tags: | + ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:${{ env.WEBCALENDAR_VERSION }}-${{ steps.extract_hash.outputs.hash }}-php8-apache-dev + ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:dev-php8-apache + ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:dev + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} From 9c6382b9f85d380e3890a997ef7e62f7d0098e82 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Mon, 25 Sep 2023 13:21:23 -0400 Subject: [PATCH 2/4] Add back some docs to docker image so build does not fail --- .dockerignore | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index a600a88e3..8d25d3e84 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,17 @@ bump_version.sh docker -docs +docs/event_status.gif +docs/extractfaqs.pl +docs/faqs.html +docs/Makefile +docs/php2html.pl +docs/README +docs/sql2html.pl +docs/WebCalendar-Database.html +docs/WebCalendar-DeveloperGuide.html +docs/WebCalendar-Functions.html +docs/WebCalendar-Styling.html +docs/WebCalendar-UserManual.html *.git *.gitignore includes/settings.php From cd65e24972ab24e1ead895ec4c6ddb08094f9191 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Mon, 25 Sep 2023 13:25:26 -0400 Subject: [PATCH 3/4] Re-order to login before push --- .github/workflows/docker-dev.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 36d9d77bc..13cf2b94b 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -16,10 +16,16 @@ jobs: - name: Extract Commit Hash id: extract_hash run: echo "::set-output name=hash::$(git rev-parse --short HEAD)" - + - name: Get WebCalendar Version run: echo "WEBCALENDAR_VERSION=$(./bump_version.sh -p)" >> $GITHUB_ENV - + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and push Docker image uses: docker/build-push-action@v3 with: @@ -31,8 +37,3 @@ jobs: ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:dev-php8-apache ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:dev - - name: Log in to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} From 6fe73e3c5da05bd977d4fdbdcc5b4a3ae6946865 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Mon, 25 Sep 2023 13:35:27 -0400 Subject: [PATCH 4/4] Attempt to fix docker login --- .github/workflows/docker-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 13cf2b94b..91f2d4223 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -21,7 +21,7 @@ jobs: run: echo "WEBCALENDAR_VERSION=$(./bump_version.sh -p)" >> $GITHUB_ENV - name: Log in to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}